diff --git a/Move2mods.lst b/Move2mods.lst new file mode 100644 index 0000000000..854eca245c --- /dev/null +++ b/Move2mods.lst @@ -0,0 +1,140 @@ +# decko stuff, leave for now +#./decko/spec/cypress/app_commands/factory_bot.rb: # ARDEP: exception RecordInvalid +#./decko/spec/cypress/app_commands/log_fail.rb:# ARDEP defined? protected +#./decko/lib/decko/engine.rb: # ARDEP should be safe, only on-load, maybe also defined?(ActiveRecord) protection needed? +#./decko/lib/decko/generators/decko/templates/config/puma.rb: # ARDEP: maybe register storage managers with establish_connection action? +#./decko/lib/decko/tasks/db.rake: # ARDEP: this is all Rails -> AR standard usages, need alternatives in loading data to storage models +#./decko/lib/decko/tasks/decko/seed.rake: # ARDEP: this is all Rails -> AR standard usages, need alternatives in loading data to storage models +#./decko/lib/decko/tasks/decko.rake: # ARDEP: this is all Rails -> AR standard usages, need alternatives in loading data to storage models +#./decko/rails/controllers/card_controller.rb: # ARDEP: exceptions RecordInvalid + +# +# I'm setting up to run a series of git mv's after the subdirs are ready in +# my working directory. The original paths with a comment about the nature of +# of the ActiveRecord dependency, and then the pattern is: +#git mv +# I'll edit the list into git mv commands and run them on this branch. + +#./card/config/initializers/02_patches/active_record.rb: # ARDEP: configuration (in filename) +#./card/config/initializers/patches.rb:# ARDEP: need to isolate this to named and optionally included place +git mv card/config/initializers/patches.rb card/mod/active_record/config/initializers +git mv card/config/initializers/02_patches/active_record.rb card/mod/active_record/config/initializers/02_patches + + +#./card/spec/lib/card/subcards_spec.rb: # ARDEP: exception RecordInvalid +#./card/spec/lib/card/set/required_field_spec.rb: # ARDEP: exception RecordInvalid (apparently can't depend on it defined?) +git mv card/spec/lib/card/subcards_spec.rb card/mod/active_record/spec/lib/card +git mv card/spec/lib/card/set/required_field_spec.rb card/mod/active_record/set + +# card/mod/core/set/all/collection.rb: # ARDEP: ::Relation +# card/mod/core/set/all/states.rb: # ARDEP: new_record? in storage API +# card/mod/core/set/all/abort.rb: # ARDEP: need a storage API to do this +git mv card/mod/core/set/all/collection.rb card/mod/active_record/set/all +git mv card/mod/core/set/all/states.rb card/mod/active_record/set/all +git mv card/mod/core/set/all/abort.rb card/mod/active_record/set/all + +git mv card/mod/core/spec/set/all/subcards_spec.rb card/mod/active_record/spec/set/all +git mv card/mod/pointer/spec/set/type/mirror_list_spec.rb card/mod/active_record/spec/set/type + +# leave in history +#./card/mod/history/set/all/history/act_listing.rb: # ARDEP: Relation +#./card/mod/history/lib/card/act.rb: # ARDEP: Relation + +# card/mod/carrierwave/spec/set/abstract/attachment/cloud_spec.rb: # ARDEP: exceptions RecordInvalid +# card/mod/carrierwave/spec/set/type/file_spec.rb: # ARDEP: exceptions RecordInvalid +#git mv card/mod/carrierwave/spec/set/abstract/cloud_spec.rb card/mod/active_record/spec/set/abstract +#git mv card/mod/carrierwave/spec/set/type/mirror_list_spec.rb card/mod/active_record/spec/set/type + +#./card/lib/generators/card.rb: # ARDEP: migration generators +#./card/lib/application_record.rb:# ARDEP: refactor this to a factory for configured storage modules that can store and use ActiveModel + +#./card/lib/cardio.rb: # ARDEP: connection object +#./card/lib/cardio/schema.rb: # ARDEP: migrations + +#./card/lib/card/model/save_helper.rb: # ARDEP: note how ! methods here should be the complete interface from Card::Model < ActiveModel when it needs AR methods and features. I think the solution is to have a 'naked' card that is just a Model, and a Card::Storage class that works like formatters to do view stuff. You need to card.to_storage to get the mutation functions used here +git mv card/lib/card/model/save_helper.rb card/mod/active_record/lib/card/model + +#./card/lib/card/cache/persistent.rb: # ARDEP: should be ActiveModel and only create AR object to manage storage process +git mv card/lib/card/cache/persistent.rb card/mod/fetch/lib/card/cache + +#./card/lib/card/migration.rb: # ARDEP: migration +git mv card/lib/card/migration.rb card/mod/active_record/lib/card +#./card/lib/card/codename.rb: # ARDEP: connection +git mv card/lib/card/codename.rb card/mod/fetch/lib/card + +#./card/lib/card/director/phases.rb: # ARDEP: exception RecordInvalid +#./card/lib/card/director/store.rb: # ARDEP: comments reflect Card::Storage class +git mv card/lib/card/director/phases.rb card/mod/storage/lib/card/director +git mv card/lib/card/director/store.rb card/mod/storage/lib/card/director + +#./card/lib/card/tasks/card/migrate.rake:#ARDEP: migrations +git mv card/lib/card/tasks/card/migrate.rake card/mod/rails/lib/card/tasks/card + +#./card/lib/card/query/sql_statement.rb: # ARDEP: connection +#./card/lib/card/query/clause.rb: # ARDEP: connection +#./card/lib/card/query/card_query/run.rb: # ARDEP: connection +git mv card/lib/card/query card/mod/active_record/lib/card + +# ./card/lib/card/error.rb: # ARDEP: exceptions RecordNotFound, RecordInvalid +# ./card/lib/card/error.rb: # ARDEP ActionController: exceptions BadRequest, MissingFile +git mv card/lib/card/error.rb card/mod/active_record/lib/card + +After the moving, we have these stats: +content + 4807 total +fetch + 957 total +storage + 129 total +rails +111 rails/lib/card/tasks/card/migrate.rake +active_record + 3297 total +utility + 99 total +admin + 363 total +core + 4931 total +virtual + 167 total +history + 1878 total +basic_formats + 1086 total +item + 199 total +pointer + 2164 total +solid_cache + 278 total +basic_types + 137 total +machines + 50018 total +settings + 947 total +email + 309 total +follow + 2280 total +developer + 202 total +carrierwave + 2324 total +media + 188 total +search + 1232 total +standard + 5702 total +rules + 1204 total +account + 1754 total +navbar + 432 total +bootstrap + 874110 total +google_analytics +39 google_analytics/set/all/google_analytics.rb diff --git a/card/README.rdoc b/card/README.rdoc index b7f82dba07..3b6a555581 100644 --- a/card/README.rdoc +++ b/card/README.rdoc @@ -27,7 +27,7 @@ When you install and seed a new Decko project, you have a working "deck" right a Ruby-on-Rails developers reading this will find lots of familiar patterns in Decko, which indeed depends upon rails gems. Although Decko is a Rails descendant and owes a ton to the Rails community, it is not Rails. Unlike Rails, Decko is not an implementation of the "MVC" (Model-View-Controller) architectural pattern (see Architecture below). More concretely, while Rails' core pattern is adding new things (especially models, views, and controllers), Decko's core pattern is subdividing existing things into new Sets. -Deck-coders do create lots of card views (though they're quite different from Rails views), but we rarely if ever create new controllers or ActiveRecord models. In the Decko gem there is one controller (CardController) and one main model ({Card}). Other models optimize the Card model and track its history: (See {Card::Reference references}, {Card::Act acts}, {Card::Action actions}, and {Card::Change changes}). +Deck-coders do create lots of card views (though they're quite different from Rails views), but we rarely if ever create new controllers or ActiveModel/ActiveRecord models. In the Decko gem there is one controller (CardController) and one main model ({Card}). Other models optimize the Card model and track its history: (See {Card::Reference references}, {Card::Act acts}, {Card::Action actions}, and {Card::Change changes}). ===Cards, Sets, and Rules diff --git a/card/lib/application_record.rb b/card/lib/application_record.rb index 10a4cba84d..b4f818212f 100644 --- a/card/lib/application_record.rb +++ b/card/lib/application_record.rb @@ -1,3 +1,4 @@ +# ARDEP: refactor this to a factory for configured storage modules that can store and use ActiveModel class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/card/lib/card/set/pattern/base.rb b/card/lib/card/set/pattern/base.rb index a54266520a..8a9ce4e25d 100644 --- a/card/lib/card/set/pattern/base.rb +++ b/card/lib/card/set/pattern/base.rb @@ -142,6 +142,7 @@ def left_type card card.superleft&.type_name || quick_type(card.name.left_name) end + # FIXME: why not make this a fetch method to use more generally too def quick_type name if name.present? card = Card.fetch name, skip_modules: true, new: {} diff --git a/card/lib/card/tasks/card/migrate.rake b/card/lib/card/tasks/card/migrate.rake index 571f4eb108..421da5e821 100644 --- a/card/lib/card/tasks/card/migrate.rake +++ b/card/lib/card/tasks/card/migrate.rake @@ -27,6 +27,7 @@ def load_mod_lib Dir.glob(Cardio.root.join("mod/*/lib/*.rb")).each { |x| require x } end +#ARDEP: migrations def without_dumping ActiveRecord::Base.dump_schema_after_migration = false yield diff --git a/card/lib/cardio.rb b/card/lib/cardio.rb index e4a7a08eb4..d3dd5bec08 100644 --- a/card/lib/cardio.rb +++ b/card/lib/cardio.rb @@ -23,6 +23,7 @@ def card_defined? end def load_card? + # ARDEP: connection object ActiveRecord::Base.connection && !card_defined? rescue false diff --git a/card/lib/cardio/schema.rb b/card/lib/cardio/schema.rb index b9ff2b3aa6..f0a819a74a 100644 --- a/card/lib/cardio/schema.rb +++ b/card/lib/cardio/schema.rb @@ -2,6 +2,7 @@ module Cardio module Schema def assume_migrated_upto_version type Cardio.schema_mode(type) do + # ARDEP: migrations ActiveRecord::Schema.assume_migrated_upto_version(Cardio.schema(type), Cardio.migration_paths(type)) end diff --git a/card/lib/generators/card.rb b/card/lib/generators/card.rb index 41688f8c23..22399c79c0 100644 --- a/card/lib/generators/card.rb +++ b/card/lib/generators/card.rb @@ -37,6 +37,7 @@ def mod_path end end + # ARDEP: migration generators class MigrationBase < ::ActiveRecord::Generators::Base extend ClassMethods end diff --git a/card/mod/Modfile b/card/mod/Modfile index 9d4de23437..a32f4e2d24 100644 --- a/card/mod/Modfile +++ b/card/mod/Modfile @@ -1,3 +1,7 @@ +mod 'content' +mod 'fetch' +mod 'storage' +mod 'active_record' mod 'utility' mod 'admin' mod 'core' diff --git a/card/config/initializers/02_patches/active_record.rb b/card/mod/active_record/config/initializers/02_patches/active_record.rb similarity index 98% rename from card/config/initializers/02_patches/active_record.rb rename to card/mod/active_record/config/initializers/02_patches/active_record.rb index 120f399c26..0fe20b7738 100644 --- a/card/config/initializers/02_patches/active_record.rb +++ b/card/mod/active_record/config/initializers/02_patches/active_record.rb @@ -15,6 +15,7 @@ # nothing is returned from the function module Patches + # ARDEP: configuration (in filename) module ActiveRecord module Relation def pluck_in_batches *columns, batch_size: 1000 diff --git a/card/config/initializers/patches.rb b/card/mod/active_record/config/initializers/patches.rb similarity index 95% rename from card/config/initializers/patches.rb rename to card/mod/active_record/config/initializers/patches.rb index 8b0e265ec6..7808d320a3 100644 --- a/card/config/initializers/patches.rb +++ b/card/mod/active_record/config/initializers/patches.rb @@ -14,6 +14,7 @@ class StackFrame end end +# ARDEP: need to isolate this to named and optionally included place module ActiveRecord #:nodoc: all class Relation include Patches::ActiveRecord::Relation @@ -72,4 +73,4 @@ module Zeitwerk #:nodoc: all class Loader prepend Patches::Zeitwerk end -end \ No newline at end of file +end diff --git a/card/lib/card/error.rb b/card/mod/active_record/lib/card/error.rb similarity index 97% rename from card/lib/card/error.rb rename to card/mod/active_record/lib/card/error.rb index c4489c4a74..564b11d65d 100644 --- a/card/lib/card/error.rb +++ b/card/mod/active_record/lib/card/error.rb @@ -62,6 +62,8 @@ def report end # error whose message can be shown to any user + # ARDEP: exceptions RecordNotFound, RecordInvalid + # ARDEP ActionController: exceptions BadRequest, MissingFile class UserError < Error cattr_accessor :user_error_classes self.user_error_classes = [self, diff --git a/card/lib/card/migration.rb b/card/mod/active_record/lib/card/migration.rb similarity index 99% rename from card/lib/card/migration.rb rename to card/mod/active_record/lib/card/migration.rb index 61fcb8b7a0..52e65ac435 100644 --- a/card/lib/card/migration.rb +++ b/card/mod/active_record/lib/card/migration.rb @@ -1,6 +1,7 @@ # -*- encoding : utf-8 -*- class Card + # ARDEP: migration class Migration < ActiveRecord::Migration[4.2] include Card::Model::SaveHelper @type = :deck_cards diff --git a/card/lib/card/model/save_helper.rb b/card/mod/active_record/lib/card/model/save_helper.rb similarity index 96% rename from card/lib/card/model/save_helper.rb rename to card/mod/active_record/lib/card/model/save_helper.rb index 959e9d3711..de77f04be0 100644 --- a/card/lib/card/model/save_helper.rb +++ b/card/mod/active_record/lib/card/model/save_helper.rb @@ -8,6 +8,7 @@ module Model # somethings fails. # All !-methods in this module rename existing cards # to resolve name conflicts) + # ARDEP: note how ! methods here should be the complete interface from Card::Model < ActiveModel when it needs AR methods and features. I think the solution is to have a 'naked' card that is just a Model, and a Card::Storage class that works like formatters to do view stuff. You need to card.to_storage to get the mutation functions used here module SaveHelper def with_user user_name Card::Auth.with current_id: Card.fetch_id(user_name) do @@ -16,6 +17,7 @@ def with_user user_name end def create_card name_or_args, content_or_args=nil + # ARDEP: is there an AM create? Card.create! create_args(name_or_args, content_or_args) end diff --git a/card/lib/card/query/abstract_query.rb b/card/mod/active_record/lib/card/query/abstract_query.rb similarity index 100% rename from card/lib/card/query/abstract_query.rb rename to card/mod/active_record/lib/card/query/abstract_query.rb diff --git a/card/lib/card/query/abstract_query/query_helper.rb b/card/mod/active_record/lib/card/query/abstract_query/query_helper.rb similarity index 100% rename from card/lib/card/query/abstract_query/query_helper.rb rename to card/mod/active_record/lib/card/query/abstract_query/query_helper.rb diff --git a/card/lib/card/query/abstract_query/tie.rb b/card/mod/active_record/lib/card/query/abstract_query/tie.rb similarity index 100% rename from card/lib/card/query/abstract_query/tie.rb rename to card/mod/active_record/lib/card/query/abstract_query/tie.rb diff --git a/card/lib/card/query/act_query.rb b/card/mod/active_record/lib/card/query/act_query.rb similarity index 100% rename from card/lib/card/query/act_query.rb rename to card/mod/active_record/lib/card/query/act_query.rb diff --git a/card/lib/card/query/action_query.rb b/card/mod/active_record/lib/card/query/action_query.rb similarity index 100% rename from card/lib/card/query/action_query.rb rename to card/mod/active_record/lib/card/query/action_query.rb diff --git a/card/lib/card/query/card_query.rb b/card/mod/active_record/lib/card/query/card_query.rb similarity index 100% rename from card/lib/card/query/card_query.rb rename to card/mod/active_record/lib/card/query/card_query.rb diff --git a/card/lib/card/query/card_query/conjunctions.rb b/card/mod/active_record/lib/card/query/card_query/conjunctions.rb similarity index 100% rename from card/lib/card/query/card_query/conjunctions.rb rename to card/mod/active_record/lib/card/query/card_query/conjunctions.rb diff --git a/card/lib/card/query/card_query/found_by.rb b/card/mod/active_record/lib/card/query/card_query/found_by.rb similarity index 100% rename from card/lib/card/query/card_query/found_by.rb rename to card/mod/active_record/lib/card/query/card_query/found_by.rb diff --git a/card/lib/card/query/card_query/interpretation.rb b/card/mod/active_record/lib/card/query/card_query/interpretation.rb similarity index 100% rename from card/lib/card/query/card_query/interpretation.rb rename to card/mod/active_record/lib/card/query/card_query/interpretation.rb diff --git a/card/lib/card/query/card_query/match_attributes.rb b/card/mod/active_record/lib/card/query/card_query/match_attributes.rb similarity index 100% rename from card/lib/card/query/card_query/match_attributes.rb rename to card/mod/active_record/lib/card/query/card_query/match_attributes.rb diff --git a/card/lib/card/query/card_query/normalization.rb b/card/mod/active_record/lib/card/query/card_query/normalization.rb similarity index 100% rename from card/lib/card/query/card_query/normalization.rb rename to card/mod/active_record/lib/card/query/card_query/normalization.rb diff --git a/card/lib/card/query/card_query/reference_attributes.rb b/card/mod/active_record/lib/card/query/card_query/reference_attributes.rb similarity index 100% rename from card/lib/card/query/card_query/reference_attributes.rb rename to card/mod/active_record/lib/card/query/card_query/reference_attributes.rb diff --git a/card/lib/card/query/card_query/relational_attributes.rb b/card/mod/active_record/lib/card/query/card_query/relational_attributes.rb similarity index 100% rename from card/lib/card/query/card_query/relational_attributes.rb rename to card/mod/active_record/lib/card/query/card_query/relational_attributes.rb diff --git a/card/lib/card/query/card_query/run.rb b/card/mod/active_record/lib/card/query/card_query/run.rb similarity index 99% rename from card/lib/card/query/card_query/run.rb rename to card/mod/active_record/lib/card/query/card_query/run.rb index b7011017e0..13458b0268 100644 --- a/card/lib/card/query/card_query/run.rb +++ b/card/mod/active_record/lib/card/query/card_query/run.rb @@ -82,6 +82,7 @@ def fetch_or_instantiate record card end + # ARDEP: connection def run_sql # puts "\nSQL = #{sql}" ActiveRecord::Base.connection.select_all sql diff --git a/card/lib/card/query/card_query/sorting.rb b/card/mod/active_record/lib/card/query/card_query/sorting.rb similarity index 100% rename from card/lib/card/query/card_query/sorting.rb rename to card/mod/active_record/lib/card/query/card_query/sorting.rb diff --git a/card/lib/card/query/clause.rb b/card/mod/active_record/lib/card/query/clause.rb similarity index 92% rename from card/lib/card/query/clause.rb rename to card/mod/active_record/lib/card/query/clause.rb index 179e09fd96..a5447dbd5f 100644 --- a/card/lib/card/query/clause.rb +++ b/card/mod/active_record/lib/card/query/clause.rb @@ -11,6 +11,7 @@ def quote v connection.quote(v) end + # ARDEP: connection def connection @connection ||= ActiveRecord::Base.connection end diff --git a/card/lib/card/query/join.rb b/card/mod/active_record/lib/card/query/join.rb similarity index 100% rename from card/lib/card/query/join.rb rename to card/mod/active_record/lib/card/query/join.rb diff --git a/card/lib/card/query/reference_query.rb b/card/mod/active_record/lib/card/query/reference_query.rb similarity index 100% rename from card/lib/card/query/reference_query.rb rename to card/mod/active_record/lib/card/query/reference_query.rb diff --git a/card/lib/card/query/sql_statement.rb b/card/mod/active_record/lib/card/query/sql_statement.rb similarity index 99% rename from card/lib/card/query/sql_statement.rb rename to card/mod/active_record/lib/card/query/sql_statement.rb index 7c49796013..9d32cbc641 100644 --- a/card/lib/card/query/sql_statement.rb +++ b/card/mod/active_record/lib/card/query/sql_statement.rb @@ -112,6 +112,7 @@ def safe_sql txt end def cast_type type + # ARDEP: connection cxn ||= ActiveRecord::Base.connection (val = cxn.cast_types[type.to_sym]) ? val[:name] : safe_sql(type) end diff --git a/card/lib/card/query/sql_statement/joins.rb b/card/mod/active_record/lib/card/query/sql_statement/joins.rb similarity index 100% rename from card/lib/card/query/sql_statement/joins.rb rename to card/mod/active_record/lib/card/query/sql_statement/joins.rb diff --git a/card/lib/card/query/sql_statement/order.rb b/card/mod/active_record/lib/card/query/sql_statement/order.rb similarity index 100% rename from card/lib/card/query/sql_statement/order.rb rename to card/mod/active_record/lib/card/query/sql_statement/order.rb diff --git a/card/lib/card/query/sql_statement/where.rb b/card/mod/active_record/lib/card/query/sql_statement/where.rb similarity index 100% rename from card/lib/card/query/sql_statement/where.rb rename to card/mod/active_record/lib/card/query/sql_statement/where.rb diff --git a/card/lib/card/query/value.rb b/card/mod/active_record/lib/card/query/value.rb similarity index 100% rename from card/lib/card/query/value.rb rename to card/mod/active_record/lib/card/query/value.rb diff --git a/card/lib/card/query/value/match_value.rb b/card/mod/active_record/lib/card/query/value/match_value.rb similarity index 100% rename from card/lib/card/query/value/match_value.rb rename to card/mod/active_record/lib/card/query/value/match_value.rb diff --git a/card/mod/core/set/all/abort.rb b/card/mod/active_record/set/all/abort.rb similarity index 97% rename from card/mod/core/set/all/abort.rb rename to card/mod/active_record/set/all/abort.rb index 76860ad16a..8d7b5e462e 100644 --- a/card/mod/core/set/all/abort.rb +++ b/card/mod/active_record/set/all/abort.rb @@ -57,6 +57,7 @@ def with_transaction_returning_status add_to_transaction remember_transaction_record_state status = abortable { yield } + # ARDEP: need a storage API to do this raise ActiveRecord::Rollback unless status end status diff --git a/card/mod/core/set/all/collection.rb b/card/mod/active_record/set/all/collection.rb similarity index 97% rename from card/mod/core/set/all/collection.rb rename to card/mod/active_record/set/all/collection.rb index 6fa609f9f3..c25bc31d96 100644 --- a/card/mod/core/set/all/collection.rb +++ b/card/mod/active_record/set/all/collection.rb @@ -17,6 +17,7 @@ def count_by_cql spec def find_each options={} # this is a copy from rails (3.2.16) and is needed because this # is performed by a relation (ActiveRecord::Relation) + # ARDEP: ::Relation find_in_batches(options) do |records| records.each { |record| yield record } end diff --git a/card/mod/core/set/all/states.rb b/card/mod/active_record/set/all/states.rb similarity index 98% rename from card/mod/core/set/all/states.rb rename to card/mod/active_record/set/all/states.rb index fa66492e38..1f7ba42269 100644 --- a/card/mod/core/set/all/states.rb +++ b/card/mod/active_record/set/all/states.rb @@ -68,6 +68,7 @@ def known? # @return [True/False] def new? + # ARDEP: new_record? in storage API new_record? || # not yet in db (from ActiveRecord) !@from_trash.nil? # in process of restoration from trash end @@ -81,4 +82,4 @@ def pristine? def user_changes? actions.joins(:act).where("card_acts.actor_id != ?", WagnBotID).exists? -end \ No newline at end of file +end diff --git a/card/spec/lib/card/set/required_field_spec.rb b/card/mod/active_record/set/required_field_spec.rb similarity index 94% rename from card/spec/lib/card/set/required_field_spec.rb rename to card/mod/active_record/set/required_field_spec.rb index 0538e56fc2..232a4879a1 100644 --- a/card/spec/lib/card/set/required_field_spec.rb +++ b/card/mod/active_record/set/required_field_spec.rb @@ -13,6 +13,7 @@ card = Card.new name: "reader", "+*read" => "me" card.set_with { require_field :read } + # ARDEP: exception RecordInvalid (apparently can't depend on it defined?) expect { card.save! }.not_to raise_error #ActiveRecord::RecordInvalid end end @@ -30,6 +31,7 @@ card end + # ARDEP: exception RecordInvalid it "can't be deleted" do card_with_required_field expect { field.delete! } diff --git a/card/spec/lib/card/subcards_spec.rb b/card/mod/active_record/spec/lib/card/subcards_spec.rb similarity index 99% rename from card/spec/lib/card/subcards_spec.rb rename to card/mod/active_record/spec/lib/card/subcards_spec.rb index 3c5e57cb4f..cc4b7d1c5a 100644 --- a/card/spec/lib/card/subcards_spec.rb +++ b/card/mod/active_record/spec/lib/card/subcards_spec.rb @@ -173,6 +173,7 @@ def with_subcard_validation_error_in_rename end end + # ARDEP: exception RecordInvalid it "works on rename (update!)" do with_subcard_validation_error_in_rename do expect{ referee.update! name: "Tea", update_referers: true } diff --git a/card/mod/core/spec/set/all/subcards_spec.rb b/card/mod/active_record/spec/set/all/subcards_spec.rb similarity index 98% rename from card/mod/core/spec/set/all/subcards_spec.rb rename to card/mod/active_record/spec/set/all/subcards_spec.rb index 8a764ae3e6..b262cf269b 100644 --- a/card/mod/core/spec/set/all/subcards_spec.rb +++ b/card/mod/active_record/spec/set/all/subcards_spec.rb @@ -7,6 +7,7 @@ end describe "add subcards" do + # ARDEP: storage transaction (storage connection API) let(:transact) { ActiveRecord::Base.connection.current_transaction } let(:record_names) { transact.records.map(&:name) } diff --git a/card/mod/pointer/spec/set/type/mirror_list_spec.rb b/card/mod/active_record/spec/set/type/mirror_list_spec.rb similarity index 99% rename from card/mod/pointer/spec/set/type/mirror_list_spec.rb rename to card/mod/active_record/spec/set/type/mirror_list_spec.rb index e2e1063861..dc5146c459 100644 --- a/card/mod/pointer/spec/set/type/mirror_list_spec.rb +++ b/card/mod/active_record/spec/set/type/mirror_list_spec.rb @@ -15,6 +15,7 @@ end end it "doesn't allow non-cardtype as right part" do + # ARDEP: exceptions RecordInvalid expect do Card["Parry Hotter+authors"].update!(name: "Parry Hotter+hidden") end.to raise_error(ActiveRecord::RecordInvalid, diff --git a/card/mod/carrierwave/spec/set/abstract/attachment/cloud_spec.rb b/card/mod/carrierwave/spec/set/abstract/attachment/cloud_spec.rb index af43ad73a0..e1b17a1162 100644 --- a/card/mod/carrierwave/spec/set/abstract/attachment/cloud_spec.rb +++ b/card/mod/carrierwave/spec/set/abstract/attachment/cloud_spec.rb @@ -71,6 +71,7 @@ def file_path it "copies file to local file system" do # not yet supported + # ARDEP: exceptions RecordInvalid expect { Card[file_card.name].update!(storage_type: :local) } .to raise_error(ActiveRecord::RecordInvalid) end diff --git a/card/mod/carrierwave/spec/set/type/file_spec.rb b/card/mod/carrierwave/spec/set/type/file_spec.rb index fef7659ed7..d6acf53631 100644 --- a/card/mod/carrierwave/spec/set/type/file_spec.rb +++ b/card/mod/carrierwave/spec/set/type/file_spec.rb @@ -39,6 +39,7 @@ def source_view card context "creating" do it "fails if no file given" do + # ARDEP: exceptions RecordInvalid expect do Card::Auth.as_bot do Card.create! name: "hide and seek", type_id: Card::FileID diff --git a/card/mod/core/chunk/escaped_literal.rb b/card/mod/content/chunk/escaped_literal.rb similarity index 100% rename from card/mod/core/chunk/escaped_literal.rb rename to card/mod/content/chunk/escaped_literal.rb diff --git a/card/mod/core/chunk/keep_escaped_literal.rb b/card/mod/content/chunk/keep_escaped_literal.rb similarity index 100% rename from card/mod/core/chunk/keep_escaped_literal.rb rename to card/mod/content/chunk/keep_escaped_literal.rb diff --git a/card/mod/core/chunk/link.rb b/card/mod/content/chunk/link.rb similarity index 100% rename from card/mod/core/chunk/link.rb rename to card/mod/content/chunk/link.rb diff --git a/card/mod/core/chunk/nest.rb b/card/mod/content/chunk/nest.rb similarity index 100% rename from card/mod/core/chunk/nest.rb rename to card/mod/content/chunk/nest.rb diff --git a/card/mod/core/chunk/query_reference.rb b/card/mod/content/chunk/query_reference.rb similarity index 100% rename from card/mod/core/chunk/query_reference.rb rename to card/mod/content/chunk/query_reference.rb diff --git a/card/mod/core/chunk/reference.rb b/card/mod/content/chunk/reference.rb similarity index 100% rename from card/mod/core/chunk/reference.rb rename to card/mod/content/chunk/reference.rb diff --git a/card/mod/core/chunk/uri.rb b/card/mod/content/chunk/uri.rb similarity index 100% rename from card/mod/core/chunk/uri.rb rename to card/mod/content/chunk/uri.rb diff --git a/card/mod/core/chunk/view_stub.rb b/card/mod/content/chunk/view_stub.rb similarity index 100% rename from card/mod/core/chunk/view_stub.rb rename to card/mod/content/chunk/view_stub.rb diff --git a/card/mod/core/format/data_format.rb b/card/mod/content/format/data_format.rb similarity index 100% rename from card/mod/core/format/data_format.rb rename to card/mod/content/format/data_format.rb diff --git a/card/mod/core/format/html_format.rb b/card/mod/content/format/html_format.rb similarity index 100% rename from card/mod/core/format/html_format.rb rename to card/mod/content/format/html_format.rb diff --git a/card/mod/core/format/text_format.rb b/card/mod/content/format/text_format.rb similarity index 100% rename from card/mod/core/format/text_format.rb rename to card/mod/content/format/text_format.rb diff --git a/card/lib/card/content.rb b/card/mod/content/lib/card/content.rb similarity index 100% rename from card/lib/card/content.rb rename to card/mod/content/lib/card/content.rb diff --git a/card/lib/card/content/chunk.rb b/card/mod/content/lib/card/content/chunk.rb similarity index 100% rename from card/lib/card/content/chunk.rb rename to card/mod/content/lib/card/content/chunk.rb diff --git a/card/lib/card/content/chunk/abstract.rb b/card/mod/content/lib/card/content/chunk/abstract.rb similarity index 100% rename from card/lib/card/content/chunk/abstract.rb rename to card/mod/content/lib/card/content/chunk/abstract.rb diff --git a/card/lib/card/content/clean.rb b/card/mod/content/lib/card/content/clean.rb similarity index 100% rename from card/lib/card/content/clean.rb rename to card/mod/content/lib/card/content/clean.rb diff --git a/card/lib/card/content/diff.rb b/card/mod/content/lib/card/content/diff.rb similarity index 100% rename from card/lib/card/content/diff.rb rename to card/mod/content/lib/card/content/diff.rb diff --git a/card/lib/card/content/diff/l_c_s.rb b/card/mod/content/lib/card/content/diff/l_c_s.rb similarity index 100% rename from card/lib/card/content/diff/l_c_s.rb rename to card/mod/content/lib/card/content/diff/l_c_s.rb diff --git a/card/lib/card/content/diff/l_c_s/processor.rb b/card/mod/content/lib/card/content/diff/l_c_s/processor.rb similarity index 100% rename from card/lib/card/content/diff/l_c_s/processor.rb rename to card/mod/content/lib/card/content/diff/l_c_s/processor.rb diff --git a/card/lib/card/content/diff/result.rb b/card/mod/content/lib/card/content/diff/result.rb similarity index 100% rename from card/lib/card/content/diff/result.rb rename to card/mod/content/lib/card/content/diff/result.rb diff --git a/card/lib/card/content/parser.rb b/card/mod/content/lib/card/content/parser.rb similarity index 100% rename from card/lib/card/content/parser.rb rename to card/mod/content/lib/card/content/parser.rb diff --git a/card/lib/card/content/truncate.rb b/card/mod/content/lib/card/content/truncate.rb similarity index 100% rename from card/lib/card/content/truncate.rb rename to card/mod/content/lib/card/content/truncate.rb diff --git a/card/lib/card/format.rb b/card/mod/content/lib/card/format.rb similarity index 100% rename from card/lib/card/format.rb rename to card/mod/content/lib/card/format.rb diff --git a/card/lib/card/format/content.rb b/card/mod/content/lib/card/format/content.rb similarity index 100% rename from card/lib/card/format/content.rb rename to card/mod/content/lib/card/format/content.rb diff --git a/card/lib/card/format/context_names.rb b/card/mod/content/lib/card/format/context_names.rb similarity index 100% rename from card/lib/card/format/context_names.rb rename to card/mod/content/lib/card/format/context_names.rb diff --git a/card/lib/card/format/error.rb b/card/mod/content/lib/card/format/error.rb similarity index 100% rename from card/lib/card/format/error.rb rename to card/mod/content/lib/card/format/error.rb diff --git a/card/lib/card/format/method_delegation.rb b/card/mod/content/lib/card/format/method_delegation.rb similarity index 100% rename from card/lib/card/format/method_delegation.rb rename to card/mod/content/lib/card/format/method_delegation.rb diff --git a/card/lib/card/format/nest.rb b/card/mod/content/lib/card/format/nest.rb similarity index 100% rename from card/lib/card/format/nest.rb rename to card/mod/content/lib/card/format/nest.rb diff --git a/card/lib/card/format/nest/fetch.rb b/card/mod/content/lib/card/format/nest/fetch.rb similarity index 100% rename from card/lib/card/format/nest/fetch.rb rename to card/mod/content/lib/card/format/nest/fetch.rb diff --git a/card/lib/card/format/nesting.rb b/card/mod/content/lib/card/format/nesting.rb similarity index 100% rename from card/lib/card/format/nesting.rb rename to card/mod/content/lib/card/format/nesting.rb diff --git a/card/lib/card/format/nesting/main.rb b/card/mod/content/lib/card/format/nesting/main.rb similarity index 100% rename from card/lib/card/format/nesting/main.rb rename to card/mod/content/lib/card/format/nesting/main.rb diff --git a/card/lib/card/format/nesting/mode.rb b/card/mod/content/lib/card/format/nesting/mode.rb similarity index 100% rename from card/lib/card/format/nesting/mode.rb rename to card/mod/content/lib/card/format/nesting/mode.rb diff --git a/card/lib/card/format/nesting/subformat.rb b/card/mod/content/lib/card/format/nesting/subformat.rb similarity index 100% rename from card/lib/card/format/nesting/subformat.rb rename to card/mod/content/lib/card/format/nesting/subformat.rb diff --git a/card/lib/card/format/registration.rb b/card/mod/content/lib/card/format/registration.rb similarity index 100% rename from card/lib/card/format/registration.rb rename to card/mod/content/lib/card/format/registration.rb diff --git a/card/lib/card/format/render.rb b/card/mod/content/lib/card/format/render.rb similarity index 100% rename from card/lib/card/format/render.rb rename to card/mod/content/lib/card/format/render.rb diff --git a/card/mod/core/set/abstract/code_file.rb b/card/mod/content/set/abstract/code_file.rb similarity index 100% rename from card/mod/core/set/abstract/code_file.rb rename to card/mod/content/set/abstract/code_file.rb diff --git a/card/mod/core/set/abstract/haml_file.rb b/card/mod/content/set/abstract/haml_file.rb similarity index 100% rename from card/mod/core/set/abstract/haml_file.rb rename to card/mod/content/set/abstract/haml_file.rb diff --git a/card/mod/core/set/abstract/lock.rb b/card/mod/content/set/abstract/lock.rb similarity index 100% rename from card/mod/core/set/abstract/lock.rb rename to card/mod/content/set/abstract/lock.rb diff --git a/card/mod/core/set/abstract/vendor_code_file.rb b/card/mod/content/set/abstract/vendor_code_file.rb similarity index 100% rename from card/mod/core/set/abstract/vendor_code_file.rb rename to card/mod/content/set/abstract/vendor_code_file.rb diff --git a/card/mod/core/set/all/chunk.rb b/card/mod/content/set/all/chunk.rb similarity index 100% rename from card/mod/core/set/all/chunk.rb rename to card/mod/content/set/all/chunk.rb diff --git a/card/mod/core/set/all/content.rb b/card/mod/content/set/all/content.rb similarity index 100% rename from card/mod/core/set/all/content.rb rename to card/mod/content/set/all/content.rb diff --git a/card/mod/core/set/all/contextual_content.rb b/card/mod/content/set/all/contextual_content.rb similarity index 100% rename from card/mod/core/set/all/contextual_content.rb rename to card/mod/content/set/all/contextual_content.rb diff --git a/card/mod/core/set/all/references.rb b/card/mod/content/set/all/references.rb similarity index 100% rename from card/mod/core/set/all/references.rb rename to card/mod/content/set/all/references.rb diff --git a/card/mod/core/spec/chunk/escaped_literal_spec.rb b/card/mod/content/spec/chunk/escaped_literal_spec.rb similarity index 100% rename from card/mod/core/spec/chunk/escaped_literal_spec.rb rename to card/mod/content/spec/chunk/escaped_literal_spec.rb diff --git a/card/mod/core/spec/chunk/keep_escaped_literal_spec.rb b/card/mod/content/spec/chunk/keep_escaped_literal_spec.rb similarity index 100% rename from card/mod/core/spec/chunk/keep_escaped_literal_spec.rb rename to card/mod/content/spec/chunk/keep_escaped_literal_spec.rb diff --git a/card/mod/core/spec/chunk/link_spec.rb b/card/mod/content/spec/chunk/link_spec.rb similarity index 100% rename from card/mod/core/spec/chunk/link_spec.rb rename to card/mod/content/spec/chunk/link_spec.rb diff --git a/card/mod/core/spec/chunk/nest_spec.rb b/card/mod/content/spec/chunk/nest_spec.rb similarity index 100% rename from card/mod/core/spec/chunk/nest_spec.rb rename to card/mod/content/spec/chunk/nest_spec.rb diff --git a/card/mod/core/spec/chunk/query_reference_spec.rb b/card/mod/content/spec/chunk/query_reference_spec.rb similarity index 100% rename from card/mod/core/spec/chunk/query_reference_spec.rb rename to card/mod/content/spec/chunk/query_reference_spec.rb diff --git a/card/mod/core/spec/chunk/uri_spec.rb b/card/mod/content/spec/chunk/uri_spec.rb similarity index 100% rename from card/mod/core/spec/chunk/uri_spec.rb rename to card/mod/content/spec/chunk/uri_spec.rb diff --git a/card/mod/core/spec/format/data_format_spec.rb b/card/mod/content/spec/format/data_format_spec.rb similarity index 100% rename from card/mod/core/spec/format/data_format_spec.rb rename to card/mod/content/spec/format/data_format_spec.rb diff --git a/card/mod/core/spec/format/html_format_spec.rb b/card/mod/content/spec/format/html_format_spec.rb similarity index 100% rename from card/mod/core/spec/format/html_format_spec.rb rename to card/mod/content/spec/format/html_format_spec.rb diff --git a/card/mod/core/spec/format/text_format_spec.rb b/card/mod/content/spec/format/text_format_spec.rb similarity index 100% rename from card/mod/core/spec/format/text_format_spec.rb rename to card/mod/content/spec/format/text_format_spec.rb diff --git a/card/mod/core/spec/set/abstract/code_file_spec.rb b/card/mod/content/spec/set/abstract/code_file_spec.rb similarity index 100% rename from card/mod/core/spec/set/abstract/code_file_spec.rb rename to card/mod/content/spec/set/abstract/code_file_spec.rb diff --git a/card/mod/core/spec/set/all/chunk_spec.rb b/card/mod/content/spec/set/all/chunk_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/chunk_spec.rb rename to card/mod/content/spec/set/all/chunk_spec.rb diff --git a/card/mod/core/spec/set/all/content_spec.rb b/card/mod/content/spec/set/all/content_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/content_spec.rb rename to card/mod/content/spec/set/all/content_spec.rb diff --git a/card/mod/core/spec/set/all/i18n_spec.rb b/card/mod/content/spec/set/all/i18n_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/i18n_spec.rb rename to card/mod/content/spec/set/all/i18n_spec.rb diff --git a/card/mod/core/spec/set/all/name_events_spec.rb b/card/mod/content/spec/set/all/name_events_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/name_events_spec.rb rename to card/mod/content/spec/set/all/name_events_spec.rb diff --git a/card/mod/core/spec/set/all/name_spec.rb b/card/mod/content/spec/set/all/name_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/name_spec.rb rename to card/mod/content/spec/set/all/name_spec.rb diff --git a/card/mod/core/spec/set/all/references_spec.rb b/card/mod/content/spec/set/all/references_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/references_spec.rb rename to card/mod/content/spec/set/all/references_spec.rb diff --git a/card/mod/core/spec/set/all/templating_spec.rb b/card/mod/content/spec/set/all/templating_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/templating_spec.rb rename to card/mod/content/spec/set/all/templating_spec.rb diff --git a/card/mod/core/spec/set/all/trash_spec.rb b/card/mod/content/spec/set/all/trash_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/trash_spec.rb rename to card/mod/content/spec/set/all/trash_spec.rb diff --git a/card/mod/core/spec/set/all/type_spec.rb b/card/mod/content/spec/set/all/type_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/type_spec.rb rename to card/mod/content/spec/set/all/type_spec.rb diff --git a/card/mod/core/set/all/initialize.rb b/card/mod/core/set/all/initialize.rb index a904af8266..32bf59498b 100644 --- a/card/mod/core/set/all/initialize.rb +++ b/card/mod/core/set/all/initialize.rb @@ -36,7 +36,7 @@ def initialize args={} handle_set_modules args do handle_type args do - super args # ActiveRecord #initialize + super args # ActiveRecord (storage classes) #initialize end end self diff --git a/card/lib/card/cache/persistent.rb b/card/mod/fetch/lib/card/cache/persistent.rb similarity index 98% rename from card/lib/card/cache/persistent.rb rename to card/mod/fetch/lib/card/cache/persistent.rb index 3e0e5a3b05..5b13d6126d 100644 --- a/card/lib/card/cache/persistent.rb +++ b/card/mod/fetch/lib/card/cache/persistent.rb @@ -53,6 +53,7 @@ def reset # @param opts [Hash] # @option opts [Rails::Cache] :store # @option opts [ruby Class] :class, typically ActiveRecord descendant + # ARDEP: should be ActiveModel and only create AR object to manage storage process # @option opts [String] :database def initialize opts @store = opts[:store] diff --git a/card/lib/card/codename.rb b/card/mod/fetch/lib/card/codename.rb similarity index 99% rename from card/lib/card/codename.rb rename to card/mod/fetch/lib/card/codename.rb index efbaea6591..dbf2da72f1 100644 --- a/card/lib/card/codename.rb +++ b/card/mod/fetch/lib/card/codename.rb @@ -106,6 +106,7 @@ def generate_id_constants # @yieldparam id [Integer] def each_codenamed_card sql = "select id, codename from cards where codename is not NULL" + # ARDEP: connection ActiveRecord::Base.connection.select_all(sql).each do |row| yield row["codename"].to_sym, row["id"].to_i end diff --git a/card/mod/core/set/all/fetch.rb b/card/mod/fetch/set/all/fetch.rb similarity index 100% rename from card/mod/core/set/all/fetch.rb rename to card/mod/fetch/set/all/fetch.rb diff --git a/card/mod/core/set/all/fetch_helper.rb b/card/mod/fetch/set/all/fetch_helper.rb similarity index 100% rename from card/mod/core/set/all/fetch_helper.rb rename to card/mod/fetch/set/all/fetch_helper.rb diff --git a/card/mod/core/spec/set/all/fetch_helper_spec.rb b/card/mod/fetch/spec/set/all/fetch_helper_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/fetch_helper_spec.rb rename to card/mod/fetch/spec/set/all/fetch_helper_spec.rb diff --git a/card/mod/core/spec/set/all/fetch_spec.rb b/card/mod/fetch/spec/set/all/fetch_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/fetch_spec.rb rename to card/mod/fetch/spec/set/all/fetch_spec.rb diff --git a/card/mod/core/spec/set/all/initialize_spec.rb b/card/mod/fetch/spec/set/all/initialize_spec.rb similarity index 100% rename from card/mod/core/spec/set/all/initialize_spec.rb rename to card/mod/fetch/spec/set/all/initialize_spec.rb diff --git a/card/mod/history/lib/card/act.rb b/card/mod/history/lib/card/act.rb index 28b5d03341..d2bb949b72 100644 --- a/card/mod/history/lib/card/act.rb +++ b/card/mod/history/lib/card/act.rb @@ -51,6 +51,7 @@ def all_with_actions_on card_ids, with_drafts=false # all acts with actions that current user has permission to view # @return [ActiveRecord Relation] + # ARDEP: Relation def all_viewable action_where=nil relation = joins(ar_actions: :ar_card) relation = relation.where(action_where) if action_where diff --git a/card/mod/history/set/all/history/act_listing.rb b/card/mod/history/set/all/history/act_listing.rb index 88e9e28791..7f24aa424e 100644 --- a/card/mod/history/set/all/history/act_listing.rb +++ b/card/mod/history/set/all/history/act_listing.rb @@ -12,6 +12,7 @@ def act_from_context # used (by history and recent)for rendering act lists with legend and paging # # @param acts [ActiveRecord::Relation] relation that will return acts objects + # ARDEP: Relation # @param context [Symbol] :relative or :absolute # @param draft_legend [Symbol] :show or :hide def acts_layout acts, context, draft_legend=:hide diff --git a/card/mod/machines/file/all_script_machine_output/file.js b/card/mod/machines/file/all_script_machine_output/file.js index 79d18dd649..38102a01dd 100644 --- a/card/mod/machines/file/all_script_machine_output/file.js +++ b/card/mod/machines/file/all_script_machine_output/file.js @@ -13442,11 +13442,19 @@ return jQuery; }).call(this); +>>>>>>> master //script: jquery helper /*! jQuery UI - v1.12.1 - 2018-05-16 * http://jqueryui.com * Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js * Copyright jQuery Foundation and other contributors; Licensed MIT */ +<<<<<<< HEAD +!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}t.ui=t.ui||{},t.ui.version="1.12.1";var i=0,s=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.remove&&t(n).triggerHandler("remove")}catch(t){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,r,a={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?void(arguments.length&&this._createWidget(t,e)):new o(t,e)},t.extend(o,n,{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)?void(a[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(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(a[e]=s)}),o.prototype=t.widget.extend(r,{widgetEventPrefix:n?r.widgetEventPrefix||e:e},a,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),r=0,a=o.length;a>r;r++)for(i in o[r])n=o[r][i],o[r].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var r="string"==typeof o,a=s.call(arguments,1),l=this;return r?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,a),i!==s&&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+"'")}):l=void 0:(a.length&&(o=t.widget.extend.apply(null,[o].concat(a))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,r=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(r={},s=e.split("."),e=s.shift(),s.length){for(n=r[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];r[e]=i}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var r,a;for(a=0;i.length>a;a++)r=n.classesElementLookup[i[a]]||t(),r=t(e.add?t.unique(r.get().concat(e.element.get())):r.not(e.element).get()),n.classesElementLookup[i[a]]=r,s.push(i[a]),o&&e.classes[i[a]]&&s.push(e.classes[i[a]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_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,r){function a(){return e||!0!==o.options.disabled&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?o[r]:r).apply(o,arguments):void 0}"string"!=typeof r&&(a.guid=r.guid=r.guid||a.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,a):i.on(h,a)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(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){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,r=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(r)&&!1===r.apply(this.element[0],[i].concat(s))||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 r,a=n?!0===n||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),r=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),r&&t.effects&&t.effects.effect[a]?s[e](n):a!==e&&s[a]?s[a](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,r=Math.abs,a=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,p=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};h>d&&d>r(e+i)&&(u.horizontal="center"),c>f&&f>r(s+a)&&(u.vertical="middle"),u.important=o(r(e),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(z,{using:a}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,r=s.width,a=t.left-e.collisionPosition.marginLeft,l=n-a,h=a+e.collisionWidth-r-n;e.collisionWidth>r?l>0&&0>=h?(i=t.left+l+e.collisionWidth-r-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+r-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-a,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,r=e.within.height,a=t.top-e.collisionPosition.marginTop,l=n-a,h=a+e.collisionHeight-r-n;e.collisionHeight>r?l>0&&0>=h?(i=t.top+l+e.collisionHeight-r-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+r-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-a,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,a=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-a-l,p="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,d="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(0>(i=t.left+p+d+f+e.collisionWidth-a-o)||r(c)>i)&&(t.left+=p+d+f):u>0&&((s=t.left-e.collisionPosition.marginLeft+p+d+f-l)>0||u>r(s))&&(t.left+=p+d+f)},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,a=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-a-l,p="top"===e.my[1],d=p?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(0>(s=t.top+d+f+m+e.collisionHeight-a-o)||r(c)>s)&&(t.top+=d+f+m):u>0&&((i=t.top-e.collisionPosition.marginTop+d+f+m-l)>0||u>r(i))&&(t.top+=d+f+m)}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,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])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,r,a,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,!(!i.href||!o||"map"!==n.nodeName.toLowerCase())&&(r=t("img[usemap='#"+o+"']"),r.length>0&&r.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(h)?(a=!i.disabled)&&(l=t(i).closest("fieldset")[0])&&(a=!l.disabled):a="a"===h?i.href||s:s,a&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},t.ui.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.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.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"))&&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)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({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.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("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.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o=!("string"!=typeof this.options.cancel||!e.target.nodeName)&&t(e.target).closest(this.options.cancel).length;return!(s&&!o&&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=!1!==this._mouseStart(e),!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.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!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)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)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=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("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)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_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.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)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",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._addClass("ui-draggable"),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")?void(this.destroyOnClear=!0):(this._removeHandleClassName(),void this._mouseDestroy())},_mouseCapture:function(e){var i=this.options;return!(this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0)&&(this.handle=this._getHandle(e),!!this.handle&&(this._blurActiveElement(e),this._blockFrames(!0===i.iframeFix?"iframe":i.iframeFix),!0))},_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=t.ui.safeActiveElement(this.document[0]);t(e.target).closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"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(),!1===this._trigger("start",e)?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),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(!1===this._trigger("drag",e,s))return this._mouseUp(new t.Event("mouseup",e)),!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||!0===this.options.revert||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==i._trigger("stop",e)&&i._clear()}):!1!==this._trigger("stop",e)&&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.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return!this.options.handle||!!t(e.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"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?void(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]):"document"===n.containment?void(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]):n.containment.constructor===Array?void(this.containment=n.containment):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),void((s=i[0])&&(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(this.containment=null)},_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,r=this.options,a=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return a&&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)),r.grid&&(n=r.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/r.grid[1])*r.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-r.grid[1]:n+r.grid[1]:n,o=r.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/r.grid[0])*r.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-r.grid[0]:o+r.grid[0]:o),"y"===r.axis&&(l=this.originalPageX),"x"===r.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:a?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:a?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_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,r=s.scrollParentNotHidden[0],a=s.document[0];r!==a&&"HTML"!==r.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+r.offsetHeight-e.pageY=0;p--)l=s.snapElements[p].left-s.margins.left,h=l+s.snapElements[p].width,c=s.snapElements[p].top-s.margins.top,u=c+s.snapElements[p].height,l-m>_||g>h+m||c-m>b||v>u+m||!t.contains(s.snapElements[p].item.ownerDocument,s.snapElements[p].item)?(s.snapElements[p].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[p].item})),s.snapElements[p].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(c-b),o=m>=Math.abs(u-v),r=m>=Math.abs(l-_),a=m>=Math.abs(h-g),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),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),d=n||o||r||a,"outer"!==f.snapMode&&(n=m>=Math.abs(c-v),o=m>=Math.abs(u-b),r=m>=Math.abs(l-g),a=m>=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),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[p].snapping&&(n||o||r||a||d)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[p].item})),s.snapElements[p].snapping=n||o||r||a||d)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,r=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});r.length&&(n=parseInt(t(r[0]).css("zIndex"),10)||0,t(r).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+r.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.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?void(e=arguments[0]):e||(e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight})},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return!(!s||(s.currentItem||s.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&o(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),!n&&(!!this.accept.call(this.element[0],s.currentItem||s.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var o=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,r=(e.positionAbs||e.position.absolute).top+e.margins.top,a=o+e.helperProportions.width,l=r+e.helperProportions.height,h=i.offset.left,c=i.offset.top,u=h+i.proportions().width,p=c+i.proportions().height;switch(s){case"fit":return o>=h&&u>=a&&r>=c&&p>=l;case"intersect":return o+e.helperProportions.width/2>h&&u>a-e.helperProportions.width/2&&r+e.helperProportions.height/2>c&&p>l-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,h,i.proportions().width);case"touch":return(r>=c&&p>=r||l>=c&&p>=l||c>r&&l>p)&&(o>=h&&u>=o||a>=h&&u>=a||h>o&&a>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],r=i?i.type:null,a=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;a.length>n;n++)if(a[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===r&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&o(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,r,a=o(e,this,this.options.tolerance,i),l=!a&&this.isover?"isout":a&&!this.isover?"isover":null;l&&(this.options.greedy&&(n=this.options.scope,r=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),r.length&&(s=t(r[0]).droppable("instance"),s.greedyChild="isover"===l)),s&&"isover"===l&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[l]=!0,this["isout"===l?"isover":"isout"]=!1,this["isover"===l?"_over":"_out"].call(this,i),s&&"isout"===l&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},!1!==t.uiBackCompat&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},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 parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_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||(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.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,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",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(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".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},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles()}},_setupHandles:function(){var e,i,s,n,o,r=this.options,a=this;if(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"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:r.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);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.on("mouseover",function(){a.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=o&&o[1]?o[1]:"se")}),r.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)((s=t(this.handles[i])[0])===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,r=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:r.width(),height:r.height()},this.originalSize=this._helper?{width:r.outerWidth(),height:r.outerHeight()}:{width:r.width(),height:r.height()},this.sizeDiff={width:r.outerWidth()-r.width(),height:r.outerHeight()-r.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),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,r=e.pageX-n.left||0,a=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),!!l&&(i=l.apply(this,[e,r,a]),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)},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,r,a,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,r={width:c.helper.width()-o,height:c.helper.height()-n},a=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,l=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(r,{top:l,left:a})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._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,r=this.options;o={minWidth:this._isNumber(r.minWidth)?r.minWidth:0,maxWidth:this._isNumber(r.maxWidth)?r.maxWidth:1/0,minHeight:this._isNumber(r.minHeight)?r.minHeight:0,maxHeight:this._isNumber(r.maxHeight)?r.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,r=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,a=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),r&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=a-e.minWidth),s&&h&&(t.left=a-e.maxWidth),r&&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]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||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._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),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;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.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),r=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,a=o?0:i.sizeDiff.width,l={width:i.size.width-a,height:i.size.height-r},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(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:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};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,r,a,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,p=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;p&&(l.containerElement=t(p),/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(p),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,r=l._hasScroll(p,"left")?p.scrollWidth:o,a=l._hasScroll(p)?p.scrollHeight:n,l.parentData={element:p,left:s.left,top:s.top,width:r,height:a}))},resize:function(e){var i,s,n,o,r=t(this).resizable("instance"),a=r.options,l=r.containerOffset,h=r.position,c=r._aspectRatio||e.shiftKey,u={top:0,left:0},p=r.containerElement,d=!0;p[0]!==document&&/static/.test(p.css("position"))&&(u=l),h.left<(r._helper?l.left:0)&&(r.size.width=r.size.width+(r._helper?r.position.left-l.left:r.position.left-u.left),c&&(r.size.height=r.size.width/r.aspectRatio,d=!1),r.position.left=a.helper?l.left:0),h.top<(r._helper?l.top:0)&&(r.size.height=r.size.height+(r._helper?r.position.top-l.top:r.position.top),c&&(r.size.width=r.size.height*r.aspectRatio,d=!1),r.position.top=r._helper?l.top:0),n=r.containerElement.get(0)===r.element.parent().get(0),o=/relative|absolute/.test(r.containerElement.css("position")),n&&o?(r.offset.left=r.parentData.left+r.position.left,r.offset.top=r.parentData.top+r.position.top):(r.offset.left=r.element.offset().left,r.offset.top=r.element.offset().top),i=Math.abs(r.sizeDiff.width+(r._helper?r.offset.left-u.left:r.offset.left-l.left)),s=Math.abs(r.sizeDiff.height+(r._helper?r.offset.top-u.top:r.offset.top-l.top)),i+r.size.width>=r.parentData.width&&(r.size.width=r.parentData.width-i,c&&(r.size.height=r.size.width/r.aspectRatio,d=!1)),s+r.size.height>=r.parentData.height&&(r.size.height=r.parentData.height-s,c&&(r.size.width=r.size.height*r.aspectRatio,d=!1)),d||(r.position.left=r.prevPosition.left,r.position.top=r.prevPosition.top,r.size.width=r.prevSize.width,r.size.height=r.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,r=t(e.helper),a=r.offset(),l=r.outerWidth()-e.sizeDiff.width,h=r.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:a.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:a.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:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,r=s.originalPosition,a={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-r.top||0,left:s.position.left-r.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)+(a[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),!1!==t.uiBackCompat&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.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,r=i.originalPosition,a=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,p=Math.round((n.height-o.height)/c)*c,d=o.width+u,f=o.height+p,m=s.maxWidth&&d>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>d,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(d+=h),v&&(f+=c),m&&(d-=h),g&&(f-=c),/^(se|s|e)$/.test(a)?(i.size.width=d,i.size.height=f):/^(ne)$/.test(a)?(i.size.width=d,i.size.height=f,i.position.top=r.top-p):/^(sw)$/.test(a)?(i.size.width=d,i.size.height=f,i.position.left=r.left-u):((0>=f-c||0>=d-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=r.top-p):(f=c-e.height,i.size.height=f,i.position.top=r.top+o.height-f),d-h>0?(i.size.width=d,i.position.left=r.left-u):(d=h-e.width,i.size.width=d,i.position.left=r.left+o.width-d))}}),t.ui.resizable,t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("
"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],r=this.opos[1],a=e.pageX,l=e.pageY;return o>a&&(i=a,a=o,o=i),r>l&&(i=l,l=r,r=i), +this.helper.css({left:o,top:r,width:a-o,height:l-r}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),h=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?h=!(c.left>a||o>c.right||c.top>l||r>c.bottom):"fit"===n.tolerance&&(h=c.left>o&&a>c.right&&c.top>r&&l>c.bottom),h?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",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._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(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){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&&(!this.options.disabled&&"static"!==this.options.type&&(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))))},_mouseStart:function(e,i,s){var n,o,r=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,r.cursorAt&&this._adjustOffsetFromHelper(r.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),r.containment&&this._setContainment(),r.cursor&&"auto"!==r.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",r.cursor),this.storedStylesheet=t("").appendTo(o)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.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&&!r.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,r=this.options,a=!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))&&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))){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,r={};o&&"x"!==o||(r.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||(r.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(r,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"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,r=o+t.width,a=t.top,l=a+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>a&&l>s+h,p="y"===this.options.axis||e+c>o&&r>e+c,d=u&&p;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?d:e+this.helperProportions.width/2>o&&r>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>a&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!s||!n)&&(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2: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(){a.push(this)}var s,n,o,r,a=[],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--)(r=t.data(o[n],this.widgetFullName))&&r!==this&&!r.options.disabled&&l.push([t.isFunction(r.options.items)?r.options.items.call(r.element):t(r.options.items,r.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),r]);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(a)},_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,r,a,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]],p=this._connectWith();if(p&&this.ready)for(i=p.length-1;i>=0;i--)for(n=t(p[i],this.document[0]),s=n.length-1;s>=0;s--)(o=t.data(n[s],this.widgetFullName))&&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(r=u[i][1],a=u[i][0],s=0,h=a.length;h>s;s++)l=t(a[s]),l.data(this.widgetName+"-item",r),c.push({item:l,instance:r,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)),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]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"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,r,a,l,h,c,u,p=null,d=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(p&&t.contains(this.containers[i].element[0],p.element[0]))continue;p=this.containers[i],d=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(p)if(1===this.containers.length)this.containers[d].containerCache.over||(this.containers[d]._trigger("over",e,this._uiHash(this)),this.containers[d].containerCache.over=1);else{for(n=1e4,o=null,c=p.floating||this._isFloating(this.currentItem),r=c?"left":"top",a=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[d].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[r],h=!1,e[u]-l>this.items[s][a]/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[d])return void(this.currentContainer.containerCache.over||(this.containers[d]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1));o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[d].element,!0),this._trigger("change",e,this._uiHash()),this.containers[d]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[d],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",e,this._uiHash(this)),this.containers[d].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.height()||document.body.parentNode.scrollHeight: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,r=e.pageY,a="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(a[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]&&(r=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((r-this.originalPageY)/n.grid[1])*n.grid[1],r=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:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:a.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:a.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),this._removeClass(this.currentItem,"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(){!1===t.Widget.prototype._trigger.apply(this,arguments)&&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.menu",{version:"1.12.1",defaultElement:"