├── .gitignore ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── lib ├── sproutcore-rails.rb └── sproutcore-rails │ ├── hjs_template.rb │ └── version.rb ├── sproutcore-rails.gemspec ├── test ├── dummy │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── javascripts │ │ │ │ ├── application.js │ │ │ │ ├── home.js │ │ │ │ └── templates │ │ │ │ │ └── test.js.hjs │ │ │ └── stylesheets │ │ │ │ ├── application.css │ │ │ │ └── home.css │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ └── home_controller.rb │ │ ├── helpers │ │ │ ├── application_helper.rb │ │ │ └── home_helper.rb │ │ ├── mailers │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ └── views │ │ │ ├── home │ │ │ └── index.html.erb │ │ │ └── layouts │ │ │ └── application.html.erb │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── backtrace_silencers.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── secret_token.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ └── routes.rb │ ├── log │ │ └── .gitkeep │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ └── favicon.ico │ ├── script │ │ └── rails │ └── tmp │ │ └── cache │ │ └── .gitkeep ├── hjstemplate_test.rb └── test_helper.rb └── vendor └── assets └── javascripts └── sproutcore.js /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | .bundle 3 | Gemfile.lock 4 | pkg/* 5 | *.rbc 6 | *.log 7 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | gemspec 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 Kisko Labs Oy 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SproutCore-Rails 2 | ================ 3 | 4 | SproutCore 2.0 for Rails 3.1. 5 | 6 | 7 | Getting started 8 | --------------- 9 | 10 | Add the gem to your application Gemfile: 11 | 12 | gem "sproutcore-rails" 13 | 14 | Run `bundle install` and add the following line to 15 | `app/assets/javascripts/application.js`: 16 | 17 | //= require sproutcore 18 | 19 | Ask Rails to serve HandlebarsJS templates to SproutCore 20 | by putting each template in a dedicated ".js.hjs" file 21 | (e.g. `app/assets/javascripts/templates/admin_panel.js.hjs`) 22 | and including the assets in your layout: 23 | 24 | <%= javascript_include_tag "templates/admin_panel" %> 25 | 26 | Bundle all templates together thanks to Sprockets, 27 | e.g create `app/assets/javascripts/templates/all.js` with: 28 | 29 | //= require_tree . 30 | 31 | Now a single line in the layout loads everything: 32 | 33 | <%= javascript_include_tag "templates/all" %> 34 | 35 | 36 | License and Copyright 37 | --------------------- 38 | 39 | Copyright (C) 2012 Kisko Labs Oy 40 | 41 | Licensed under the MIT License. See the LICENSE file for details. 42 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler" 2 | Bundler::GemHelper.install_tasks 3 | 4 | require 'rake/testtask' 5 | 6 | Rake::TestTask.new(:test) do |t| 7 | t.libs << 'lib' 8 | t.libs << 'test' 9 | t.pattern = 'test/**/*_test.rb' 10 | t.verbose = false 11 | end 12 | 13 | task :default => :test 14 | -------------------------------------------------------------------------------- /lib/sproutcore-rails.rb: -------------------------------------------------------------------------------- 1 | require 'sprockets/engines' 2 | require 'sproutcore-rails/hjs_template' 3 | 4 | module SproutCoreRails 5 | class Engine < Rails::Engine 6 | end 7 | 8 | # Registers the HandlebarsJS template engine so that 9 | # an asset file having the extension ".hjs" is processed 10 | # by the asset pipeline and converted to javascript code. 11 | Sprockets.register_engine '.hjs', HjsTemplate 12 | end 13 | -------------------------------------------------------------------------------- /lib/sproutcore-rails/hjs_template.rb: -------------------------------------------------------------------------------- 1 | require 'tilt/template' 2 | 3 | module SproutCoreRails 4 | # = Sprockets engine for HandlebarsJS templates 5 | class HjsTemplate < Tilt::Template 6 | def self.default_mime_type 7 | 'application/javascript' 8 | end 9 | 10 | def initialize_engine 11 | end 12 | 13 | def prepare 14 | end 15 | 16 | # Generates Javascript code from a HandlebarsJS template. 17 | # The SC template name is derived from the lowercase logical asset path 18 | # by replacing non-alphanum characheters by underscores. 19 | def evaluate(scope, locals, &block) 20 | template = data.dup 21 | template.gsub!(/"/, '\\"') 22 | template.gsub!(/\r?\n/, '\\n') 23 | template.gsub!(/\t/, '\\t') 24 | "SC.TEMPLATES[\"#{scope.logical_path.downcase.gsub(/[^a-z0-9]/, '_')}\"] = SC.Handlebars.compile(\"#{template}\");\n" 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/sproutcore-rails/version.rb: -------------------------------------------------------------------------------- 1 | module SproutCoreRails 2 | VERSION = "0.1.0" 3 | end 4 | -------------------------------------------------------------------------------- /sproutcore-rails.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require "sproutcore-rails/version" 4 | 5 | Gem::Specification.new do |s| 6 | s.name = "sproutcore-rails" 7 | s.version = SproutCoreRails::VERSION 8 | s.platform = Gem::Platform::RUBY 9 | s.authors = ["Joao Carlos"] 10 | s.email = ["contact@kiskolabs.com"] 11 | s.homepage = "https://github.com/kiskolabs/sproutcore-rails" 12 | s.summary = "SproutCore 2 for Rails 3.1." 13 | 14 | s.add_development_dependency "rails", ["~> 3.1.0.rc"] 15 | 16 | s.files = %w(README.md) + Dir["lib/**/*", "vendor/**/*"] 17 | 18 | s.require_paths = ["lib"] 19 | end 20 | -------------------------------------------------------------------------------- /test/dummy/Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Dummy::Application.load_tasks 8 | -------------------------------------------------------------------------------- /test/dummy/app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into including all the files listed below. 2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 3 | // be included in the compiled file accessible from http://example.com/assets/application.js 4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 5 | // the compiled file. 6 | // 7 | //= require_tree . 8 | -------------------------------------------------------------------------------- /test/dummy/app/assets/javascripts/home.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /test/dummy/app/assets/javascripts/templates/test.js.hjs: -------------------------------------------------------------------------------- 1 | {{test}} 2 | -------------------------------------------------------------------------------- /test/dummy/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory 3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. 5 | *= require_self 6 | *= require_tree . 7 | */ -------------------------------------------------------------------------------- /test/dummy/app/assets/stylesheets/home.css: -------------------------------------------------------------------------------- 1 | /* 2 | Place all the styles related to the matching controller here. 3 | They will automatically be included in application.css. 4 | */ 5 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /test/dummy/app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | end 4 | 5 | end 6 | -------------------------------------------------------------------------------- /test/dummy/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/dummy/app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /test/dummy/app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kiskolabs/sproutcore-rails/33d3a029fc4fb4b46560cc1fc9e9398476879e30/test/dummy/app/mailers/.gitkeep -------------------------------------------------------------------------------- /test/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kiskolabs/sproutcore-rails/33d3a029fc4fb4b46560cc1fc9e9398476879e30/test/dummy/app/models/.gitkeep -------------------------------------------------------------------------------- /test/dummy/app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |

Home#index

2 |

Find me in app/views/home/index.html.erb

3 | -------------------------------------------------------------------------------- /test/dummy/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dummy 5 | <%= stylesheet_link_tag "application" %> 6 | <%= javascript_include_tag "application" %> 7 | <%= javascript_include_tag "templates/test" %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/dummy/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Dummy::Application 5 | -------------------------------------------------------------------------------- /test/dummy/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require "action_controller/railtie" 4 | require "rails/test_unit/railtie" 5 | 6 | Bundler.require 7 | require "sproutcore-rails" 8 | 9 | module Dummy 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Custom directories with classes and modules you want to be autoloadable. 16 | # config.autoload_paths += %W(#{config.root}/extras) 17 | 18 | # Only load the plugins named here, in the order given (default is alphabetical). 19 | # :all can be used as a placeholder for all plugins not explicitly named. 20 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 21 | 22 | # Activate observers that should always be running. 23 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 24 | 25 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 26 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 27 | # config.time_zone = 'Central Time (US & Canada)' 28 | 29 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 30 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 31 | # config.i18n.default_locale = :de 32 | 33 | # Configure the default encoding used in templates for Ruby 1.9. 34 | config.encoding = "utf-8" 35 | 36 | # Configure sensitive parameters which will be filtered from the log file. 37 | config.filter_parameters += [:password] 38 | 39 | # Enable the asset pipeline 40 | config.assets.enabled = true 41 | end 42 | end 43 | 44 | -------------------------------------------------------------------------------- /test/dummy/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | gemfile = File.expand_path('../../../../Gemfile', __FILE__) 3 | 4 | if File.exist?(gemfile) 5 | ENV['BUNDLE_GEMFILE'] = gemfile 6 | require 'bundler' 7 | Bundler.setup 8 | end 9 | 10 | $:.unshift File.expand_path('../../../../lib', __FILE__) -------------------------------------------------------------------------------- /test/dummy/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /test/dummy/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Dummy::Application.initialize! 6 | -------------------------------------------------------------------------------- /test/dummy/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | # config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger 20 | config.active_support.deprecation = :log 21 | 22 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | 25 | # Do not compress assets 26 | config.assets.compress = false 27 | end 28 | -------------------------------------------------------------------------------- /test/dummy/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress JavaScripts and CSS 15 | config.assets.compress = true 16 | 17 | # Specify the default JavaScript compressor 18 | config.assets.js_compressor = :uglifier 19 | 20 | # Specifies the header that your server uses for sending files 21 | # (comment out if your front-end server doesn't support this) 22 | config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx 23 | 24 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 25 | # config.force_ssl = true 26 | 27 | # See everything in the log (default is :info) 28 | # config.log_level = :debug 29 | 30 | # Use a different logger for distributed setups 31 | # config.logger = SyslogLogger.new 32 | 33 | # Use a different cache store in production 34 | # config.cache_store = :mem_cache_store 35 | 36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 37 | # config.action_controller.asset_host = "http://assets.example.com" 38 | 39 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 40 | # config.assets.precompile += %w( search.js ) 41 | 42 | # Disable delivery errors, bad email addresses will be ignored 43 | # config.action_mailer.raise_delivery_errors = false 44 | 45 | # Enable threaded mode 46 | # config.threadsafe! 47 | 48 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 49 | # the I18n.default_locale when a translation can not be found) 50 | config.i18n.fallbacks = true 51 | 52 | # Send deprecation notices to registered listeners 53 | config.active_support.deprecation = :notify 54 | end 55 | -------------------------------------------------------------------------------- /test/dummy/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | # config.action_mailer.delivery_method = :test 31 | 32 | # Use SQL instead of Active Record's schema dumper when creating the test database. 33 | # This is necessary if your schema can't be completely dumped by the schema dumper, 34 | # like if you have constraints or database-specific column types 35 | # config.active_record.schema_format = :sql 36 | 37 | # Print deprecation notices to the stderr 38 | config.active_support.deprecation = :stderr 39 | end 40 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | Dummy::Application.config.secret_token = '3499a0cb5ffbbcbf4a36f0202d145eac76a1e58ed992b7f7deb659d776b25c658799dbd3b69ecd913ad645e8e694673ae41393d4e6353ae86105f3fc099d7d66' 8 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Dummy::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /test/dummy/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActionController::Base.wrap_parameters :format => [:json] 8 | 9 | # Disable root element in JSON by default. 10 | if defined?(ActiveRecord) 11 | ActiveRecord::Base.include_root_in_json = false 12 | end 13 | -------------------------------------------------------------------------------- /test/dummy/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /test/dummy/config/routes.rb: -------------------------------------------------------------------------------- 1 | Dummy::Application.routes.draw do 2 | get "home/index" 3 | 4 | # The priority is based upon order of creation: 5 | # first created -> highest priority. 6 | 7 | # Sample of regular route: 8 | # match 'products/:id' => 'catalog#view' 9 | # Keep in mind you can assign values other than :controller and :action 10 | 11 | # Sample of named route: 12 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 13 | # This route can be invoked with purchase_url(:id => product.id) 14 | 15 | # Sample resource route (maps HTTP verbs to controller actions automatically): 16 | # resources :products 17 | 18 | # Sample resource route with options: 19 | # resources :products do 20 | # member do 21 | # get 'short' 22 | # post 'toggle' 23 | # end 24 | # 25 | # collection do 26 | # get 'sold' 27 | # end 28 | # end 29 | 30 | # Sample resource route with sub-resources: 31 | # resources :products do 32 | # resources :comments, :sales 33 | # resource :seller 34 | # end 35 | 36 | # Sample resource route with more complex sub-resources 37 | # resources :products do 38 | # resources :comments 39 | # resources :sales do 40 | # get 'recent', :on => :collection 41 | # end 42 | # end 43 | 44 | # Sample resource route within a namespace: 45 | # namespace :admin do 46 | # # Directs /admin/products/* to Admin::ProductsController 47 | # # (app/controllers/admin/products_controller.rb) 48 | # resources :products 49 | # end 50 | 51 | # You can have the root of your site routed with "root" 52 | # just remember to delete public/index.html. 53 | # root :to => 'welcome#index' 54 | 55 | # See how all your routes lay out with "rake routes" 56 | 57 | # This is a legacy wild controller route that's not recommended for RESTful applications. 58 | # Note: This route will make all actions in every controller accessible via GET requests. 59 | # match ':controller(/:action(/:id(.:format)))' 60 | end 61 | -------------------------------------------------------------------------------- /test/dummy/log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kiskolabs/sproutcore-rails/33d3a029fc4fb4b46560cc1fc9e9398476879e30/test/dummy/log/.gitkeep -------------------------------------------------------------------------------- /test/dummy/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/dummy/public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/dummy/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |

We've been notified about this issue and we'll take a look at it shortly.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /test/dummy/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kiskolabs/sproutcore-rails/33d3a029fc4fb4b46560cc1fc9e9398476879e30/test/dummy/public/favicon.ico -------------------------------------------------------------------------------- /test/dummy/script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rbx 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /test/dummy/tmp/cache/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kiskolabs/sproutcore-rails/33d3a029fc4fb4b46560cc1fc9e9398476879e30/test/dummy/tmp/cache/.gitkeep -------------------------------------------------------------------------------- /test/hjstemplate_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class HomeControllerTest < ActionController::TestCase 4 | 5 | test "page header should include link to asset" do 6 | get :index 7 | assert_response :success 8 | assert_select 'head script[type="text/javascript"][src="/assets/templates/test.js"]', true 9 | end 10 | 11 | end 12 | 13 | class HjsTemplateTest < ActionController::IntegrationTest 14 | 15 | test "asset pipeline should serve template" do 16 | get "/assets/templates/test.js" 17 | assert_response :success 18 | assert @response.body == "SC.TEMPLATES[\"templates_test\"] = SC.Handlebars.compile(\"{{test}}\\n\");\n" 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # Configure Rails Environment 2 | ENV["RAILS_ENV"] = "test" 3 | 4 | require File.expand_path("../dummy/config/environment.rb", __FILE__) 5 | require "rails/test_help" 6 | 7 | Rails.backtrace_cleaner.remove_silencers! 8 | 9 | # Load support files 10 | Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } 11 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/sproutcore.js: -------------------------------------------------------------------------------- 1 | // ========================================================================== 2 | // Project: SproutCore - JavaScript Application Framework 3 | // Copyright: ©2006-2011 Strobe Inc. and contributors. 4 | // Portions ©2008-2011 Apple Inc. All rights reserved. 5 | // License: Licensed under MIT license (see license.js) 6 | // ========================================================================== 7 | 8 | (function(){var a=function(){var a={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,param:27,STRING:28,hashSegments:29,hashSegment:30,ID:31,EQUALS:32,pathSegments:33,SEP:34,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",31:"ID",32:"EQUALS",34:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[26,1],[29,2],[29,1],[30,3],[30,3],[21,1],[33,3],[33,1]],performAction:function(a,b,c,d,e,f,g){var h=f.length-1;switch(e){case 1:return f[h-1];case 2:this.$=new d.ProgramNode(f[h-2],f[h]);break;case 3:this.$=new d.ProgramNode(f[h]);break;case 4:this.$=new d.ProgramNode([]);break;case 5:this.$=[f[h]];break;case 6:f[h-1].push(f[h]),this.$=f[h-1];break;case 7:this.$=new d.InverseNode(f[h-2],f[h-1],f[h]);break;case 8:this.$=new d.BlockNode(f[h-2],f[h-1],f[h]);break;case 9:this.$=f[h];break;case 10:this.$=f[h];break;case 11:this.$=new d.ContentNode(f[h]);break;case 12:this.$=new d.CommentNode(f[h]);break;case 13:this.$=new d.MustacheNode(f[h-1][0],f[h-1][1]);break;case 14:this.$=new d.MustacheNode(f[h-1][0],f[h-1][1]);break;case 15:this.$=f[h-1];break;case 16:this.$=new d.MustacheNode(f[h-1][0],f[h-1][1]);break;case 17:this.$=new d.MustacheNode(f[h-1][0],f[h-1][1],!0);break;case 18:this.$=new d.PartialNode(f[h-1]);break;case 19:this.$=new d.PartialNode(f[h-2],f[h-1]);break;case 20:break;case 21:this.$=[[f[h-2]].concat(f[h-1]),f[h]];break;case 22:this.$=[[f[h-1]].concat(f[h]),null];break;case 23:this.$=[[f[h-1]],f[h]];break;case 24:this.$=[[f[h]],null];break;case 25:f[h-1].push(f[h]),this.$=f[h-1];break;case 26:this.$=[f[h]];break;case 27:this.$=f[h];break;case 28:this.$=new d.StringNode(f[h]);break;case 29:this.$=new d.HashNode(f[h]);break;case 30:f[h-1].push(f[h]),this.$=f[h-1];break;case 31:this.$=[f[h]];break;case 32:this.$=[f[h-2],f[h]];break;case 33:this.$=[f[h-2],new d.StringNode(f[h])];break;case 34:this.$=new d.IdNode(f[h]);break;case 35:f[h-2].push(f[h]),this.$=f[h-2];break;case 36:this.$=[f[h]]}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,31:[1,25],33:24},{17:26,21:23,31:[1,25],33:24},{17:27,21:23,31:[1,25],33:24},{17:28,21:23,31:[1,25],33:24},{21:29,31:[1,25],33:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,31:[1,25],33:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:39,30:42,31:[1,43],33:24},{18:[2,34],28:[2,34],31:[2,34],34:[1,44]},{18:[2,36],28:[2,36],31:[2,36],34:[2,36]},{18:[1,45]},{18:[1,46]},{18:[1,47]},{18:[1,48],21:49,31:[1,25],33:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:50,31:[1,25],33:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:51,27:52,28:[1,41],29:39,30:42,31:[1,43],33:24},{18:[2,23]},{18:[2,26],28:[2,26],31:[2,26]},{18:[2,29],30:53,31:[1,54]},{18:[2,27],28:[2,27],31:[2,27]},{18:[2,28],28:[2,28],31:[2,28]},{18:[2,31],31:[2,31]},{18:[2,36],28:[2,36],31:[2,36],32:[1,55],34:[2,36]},{31:[1,56]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,57]},{18:[1,58]},{18:[2,21]},{18:[2,25],28:[2,25],31:[2,25]},{18:[2,30],31:[2,30]},{32:[1,55]},{21:59,28:[1,60],31:[1,25],33:24},{18:[2,35],28:[2,35],31:[2,35],34:[2,35]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,32],31:[2,32]},{18:[2,33],31:[2,33]}],defaultActions:{16:[2,1],37:[2,23],51:[2,21]},parseError:function(a,b){throw new Error(a)},parse:function(a){function o(){var a;a=b.lexer.lex()||1,typeof a!="number"&&(a=b.symbols_[a]||a);return a}function n(a){c.length=c.length-2*a,d.length=d.length-a,e.length=e.length-a}var b=this,c=[0],d=[null],e=[],f=this.table,g="",h=0,i=0,j=0,k=2,l=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var m=this.lexer.yylloc;e.push(m),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var p,q,r,s,t,u,v={},w,x,y,z;for(;;){r=c[c.length-1],this.defaultActions[r]?s=this.defaultActions[r]:(p==null&&(p=o()),s=f[r]&&f[r][p]);if(typeof s=="undefined"||!s.length||!s[0]){if(!j){z=[];for(w in f[r])this.terminals_[w]&&w>2&&z.push("'"+this.terminals_[w]+"'");var A="";this.lexer.showPosition?A="Parse error on line "+(h+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+z.join(", "):A="Parse error on line "+(h+1)+": Unexpected "+(p==1?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(A,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:m,expected:z})}if(j==3){if(p==l)throw new Error(A||"Parsing halted.");i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,p=o()}for(;;){if(k.toString()in f[r])break;if(r==0)throw new Error(A||"Parsing halted.");n(1),r=c[c.length-1]}q=p,p=k,r=c[c.length-1],s=f[r]&&f[r][k],j=3}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:c.push(p),d.push(this.lexer.yytext),e.push(this.lexer.yylloc),c.push(s[1]),p=null,q?(p=q,q=null):(i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,j>0&&j--);break;case 2:x=this.productions_[s[1]][1],v.$=d[d.length-x],v._$={first_line:e[e.length-(x||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(x||1)].first_column,last_column:e[e.length-1].last_column},u=this.performAction.call(v,g,i,h,this.yy,s[1],d,e);if(typeof u!="undefined")return u;x&&(c=c.slice(0,-1*x*2),d=d.slice(0,-1*x),e=e.slice(0,-1*x)),c.push(this.productions_[s[1]][0]),d.push(v.$),e.push(v._$),y=f[c[c.length-2]][c[c.length-1]],c.push(y);break;case 3:return!0}}return!0}},f=function(){var a={EOF:1,parseError:function(a,b){if(this.yy.parseError)this.yy.parseError(a,b);else throw new Error(a)},setInput:function(a){this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};return this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.match+=a,this.matched+=a;var b=a.match(/\n/);b&&this.yylineno++,this._input=this._input.slice(1);return a},unput:function(a){this._input=a+this._input;return this},more:function(){this._more=!0;return this},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;a.length<20&&(a+=this._input.substr(0,20-a.length));return(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");var e=this._currentRules();for(var f=0;f/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^[a-zA-Z0-9_-]+(?=[=} /.])/,/^./,/^$/],a.conditions={mu:{rules:[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],inclusive:!1},INITIAL:{rules:[0,1,21],inclusive:!0}};return a}();a.lexer=f;return a}();Handlebars={},Handlebars.VERSION="1.0.beta.1",Handlebars.Parser=a,Handlebars.parse=function(a){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(a)},Handlebars.print=function(a){return(new Handlebars.PrintVisitor).accept(a)},Handlebars.helpers={},Handlebars.partials={},Handlebars.registerHelper=function(a,b,c){c&&(b.not=c),this.helpers[a]=b},Handlebars.registerPartial=function(a,b){this.partials[a]=b},Handlebars.registerHelper("helperMissing",function(a){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+a+"'")}),Handlebars.registerHelper("blockHelperMissing",function(a,b,c){c=c||function(){};var d="",e=Object.prototype.toString.call(a);e==="[object Function]"&&(a=a());if(a===!0)return b(this);if(a===!1||a==null)return c(this);if(e==="[object Array]"){if(a.length>0)for(var f=0,g=a.length;f0)for(var e=0,f=a.length;e":">"},b=/&(?!\w+;)|[<>]/g,c=/[&<>]/,d=function(b){return a[b]||"&"};Handlebars.Utils={escapeExpression:function(a){if(a instanceof Handlebars.SafeString)return a.toString();if(a==null||a===!1)return"";if(!c.test(a))return a;return a.replace(b,d)},isEmpty:function(a){return typeof a=="undefined"?!0:a===null?!0:a===!1?!0:Object.prototype.toString.call(a)==="[object Array]"&&a.length===0?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(a,b){a.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,invokeInverse:14,assignToHash:15,pushStringParam:16},a.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:1,lookup:1,invokeMustache:2,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:2,invokePartial:1,push:1,invokeInverse:1,assignToHash:1,pushStringParam:1},a.DISASSEMBLE_MAP={};for(var c in a.OPCODE_MAP){var d=a.OPCODE_MAP[c];a.DISASSEMBLE_MAP[d]=c}a.multiParamSize=function(b){return a.MULTI_PARAM_OPCODES[a.DISASSEMBLE_MAP[b]]},a.prototype={compiler:a,disassemble:function(){var b=this.opcodes,c,d,e=[],f,g,h;for(var i=0,j=b.length;i0&&(this.source[0]=this.source[0]+", "+b.join(", ")),this.source[0]=this.source[0]+";",this.source.push("return buffer;");var c=["Handlebars","context","helpers","partials"];this.options.data&&c.push("data");for(var d=0,e=this.environment.depths.list.length;dthis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot);return"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var e="break case catch continue default delete do else finally for function if in instanceof new return switch this throw try typeof var void while with null true false".split(" ");compilerWords=b.RESERVED_WORDS={};for(var f=0,g=e.length;f0&&d[k-1]!=="."?(a&&b(a,!1).proto!==a?a=h(a,d.slice(0,k)):a=null,d=d.slice(k+1)):a===window&&(g=n(d),a=c(a,g),d=d.slice(g.length+1));if(!d||d.length===0)throw new Error("Invalid Path");i[0]=a,i[1]=d;return i}function n(a){return a.match(m)[0]}function h(a,b){var d=b.length,e,f,g;e=b.indexOf("*");if(e>0&&b[e-1]!==".")return h(h(a,b.slice(0,e)),b.slice(e+1));e=0;while(a&&e0){var e=o(a,b);a=e[0],b=e[1]}return h(a,b)},SC.setPath=function(a,b,c){var d;arguments.length===2&&"string"==typeof a&&(c=b,b=a,a=null),b=g(b);if(b.indexOf("*")>0){var e=o(a,b);a=e[0],b=e[1]}if(b.indexOf(".")>0)d=b.slice(b.lastIndexOf(".")+1),b=b.slice(0,b.length-(d.length+1)),!l.test(b)&&k.test(b)&&b.indexOf(".")<0?a=window[b]:b!=="this"&&(a=SC.getPath(a,b));else{if(k.test(b))throw new Error("Invalid Path");d=b}if(!d||d.length===0||d==="*")throw new Error("Invalid Path");return SC.set(a,d,c)}}(),function(){function r(a,b){return b==="toString"?"function"!=typeof a.toString:!!a[b]}function q(a){var b=p[a];b||(b=p[a]=function(b){return m(this,a,b)});return b}function o(a){var b=n[a];b||(b=n[a]=function(){return l(this,a)});return b}function m(a,b,c){var e=d(a),f;f=e.watching[b]>0&&c!==e.values[b],f&&SC.propertyWillChange(a,b),e.values[b]=c,f&&SC.propertyDidChange(a,b);return c}function l(a,b){var c=d(a,!1);return c.source===a&&c.values[b]}var a=SC.USE_ACCESSORS,b=SC.GUID_KEY,c=SC.META_KEY,d=SC.meta,e=SC.platform.create,f=SC.platform.defineProperty,g,h,i={writable:!0,configurable:!0,enumerable:!0,value:null};SC.Descriptor=function(){};var j=SC.Descriptor.prototype;j.set=function(a,b,c){a[b]=c;return c},j.get=function(a,b){return a[b]},j.setup=function(a,b,c){i.value=c,f(a,b,i),i.value=null},j.teardown=function(a,b){return a[b]},j.val=function(a,b){return a[b]},a||(SC.Descriptor.MUST_USE_GETTER=function(){sc_assert("Must use SC.get() to access this property",!1)},SC.Descriptor.MUST_USE_SETTER=function(){sc_assert("Must use SC.set() to access this property",!1)});var k={configurable:!0,enumerable:!0,set:SC.Descriptor.MUST_USE_SETTER},n={},p={};h=new SC.Descriptor,SC.platform.hasPropertyAccessors?(h.get=l,h.set=m,a?h.setup=function(a,b,c){k.get=o(b),k.set=q(b),f(a,b,k),k.get=k.set=null,c!==undefined&&(d(a).values[b]=c)}:h.setup=function(a,b,c){k.get=o(b),f(a,b,k),k.get=null,c!==undefined&&(d(a).values[b]=c)},h.teardown=function(a,b){var c=d(a).values[b];delete d(a).values[b];return c}):h.set=function(a,b,c){var e=d(a),f;f=e.watching[b]>0&&c!==a[b],f&&SC.propertyWillChange(a,b),a[b]=c,f&&SC.propertyDidChange(a,b);return c},SC.SIMPLE_PROPERTY=new SC.Descriptor,g=SC.SIMPLE_PROPERTY,g.unwatched=h.unwatched=g,g.watched= 9 | h.watched=h,SC.defineProperty=function(a,b,c,e){var h=d(a,!1),i=h.descs,j=h.watching[b]>0;e===undefined?e=r(i,b)?i[b].teardown(a,b):a[b]:r(i,b)&&i[b].teardown(a,b),c||(c=g),c instanceof SC.Descriptor?(h=d(a,!0),i=h.descs,c=(j?c.watched:c.unwatched)||c,i[b]=c,c.setup(a,b,e,j)):(i[b]&&(d(a).descs[b]=null),f(a,b,c));return this},SC.create=function(a,d){var f=e(a,d);b in f&&SC.generateGuid(f,"sc"),c in f&&SC.rewatch(f);return f},SC.createPrototype=function(a,f){var g=e(a,f);d(g,!0).proto=g,b in g&&SC.generateGuid(g,"sc"),c in g&&SC.rewatch(g);return g},SC.destroy=function(a){a[c]&&(a[c]=null)}}(),function(){function n(c,d){var e=d._cacheable,f=d.func;return function(g){var h=a(this,e),i=h.source===this&&h.watching[c]>0,j,k,l;k=d._suspended,d._suspended=this,i=i&&h.lastSetValues[c]!==b(g),i&&(h.lastSetValues[c]=b(g),SC.propertyWillChange(this,c)),e&&delete h.cache[c],j=f.call(this,c,g),e&&(h.cache[c]=j),i&&SC.propertyDidChange(this,c),d._suspended=k;return j}}function m(b,c){var d=c._cacheable,e=c.func;return d?function(){var c,d=a(this).cache;if(b in d)return d[b];c=d[b]=e.call(this,b);return c}:function(){return e.call(this,b)}}function k(a,b){this.func=a,this._cacheable=b&&b.cacheable,this._dependentKeys=b&&b.dependentKeys}function j(a,b,c){var d=a._dependentKeys,e=d?d.length:0;for(var f=0;f0,i,j,k;j=this._suspended,this._suspended=c,h=h&&g.lastSetValues[d]!==b(e),h&&(g.lastSetValues[d]=b(e),SC.propertyWillChange(c,d)),f&&delete g.cache[d],i=this.func.call(c,d,e),f&&(g.cache[d]=i),h&&SC.propertyDidChange(c,d),this._suspended=j;return i},o.val=function(b,c){return a(b,!1).values[c]},SC.platform.hasPropertyAccessors?c||(o.setup=function(a,b){f(a,b,l),j(this,a,b)}):o.setup=function(a,b,c){a[b]=undefined,j(this,a,b)},SC.computed=function(a){return new k(a)}}(),function(){function n(a,c){var d=b(a,!1).listeners,e=[];d&&(d=d[c]);if(!d)return e;var f,h,i,j;for(f in d){if(g[f]||!d[f])continue;i=d[f];for(h in i){if(g[h]||!i[h])continue;j=i[h],e.push([j.target,j.method])}}return e}function m(a,c){var d=b(a,!1).listeners;d&&(d=d[c]);if(!d)return!1;var f,h,i;for(f in d){if(g[f]||!d[f])continue;i=d[f];for(h in i){if(g[h]||!i[h])continue;return!0}}var j=e(b(a,!0),a,!0,"listeners");j[c]=null;return!1}function l(a,c){a&&"function"==typeof a.sendEvent&&a.sendEvent.apply(a,d.call(arguments,1));var e=b(a,!1).listeners;if(e&&(e=e[c])){h(e,arguments);return!0}return!1}function k(a){var c=b(a,!1).listeners,d=[];if(c)for(var e in c)!g[e]&&c[e]&&d.push(e);return d}function j(a,b,d,e){!e&&"function"==typeof d&&(e=d,d=null);var g=f(a,b,d,!0),h=c(e);g&&g[h]&&(g[h]=null),a&&"function"==typeof a.didRemoveListener&&a.didRemoveListener(b,d,e)}function i(a,b,d,e,g){!e&&"function"==typeof d&&(e=d,d=null);var h=f(a,b,d,!0),i=c(e),j;h[i]?h[i].xform=g:h[i]={target:d,method:e,xform:g},a&&"function"==typeof a.didAddListener&&a.didAddListener(b,d,e);return j}function h(a,b){var c,d,e,f,h,i;for(c in a){if(g[c])continue;e=a[c];for(d in e){if(g[d]||!(f=e[d]))continue;h=f.method,i=f.target,i||(i=b[0]),"string"==typeof h&&(h=i[h]),f.xform?f.xform(i,h,b):h.apply(i,b)}}}function f(a,c,d,f){return e(b(a,f),a,f,"listeners",c,d)}function e(b,c,d){var e=arguments.length,f,g,h;for(f=3;f2&&(f=SC.getPath(d,e)),b.call(a,d,e,f)}function n(a,b,c){var d=c[0],e=l(c[1]),f;b.length>2&&(f=SC.getPath(d,e)),b.call(a,d,e,f)}function m(a){return a.slice(0,-7)}function l(a){return a.slice(0,-7)}function k(a){return a+b}function j(b){return b+a}function i(){if(!!f&&f.length!==0){var a=f;f=[],g={},a.forEach(function(a){SC.sendEvent(a[0],a[1])})}}function h(a,b){if(e){var d=c(a);g[d]||(g[d]={}),g[d][b]||(g[d][b]=!0,f.push([a,b]))}else SC.sendEvent(a,b)}var a=":change",b=":before",c=SC.guidFor,d=SC.normalizePath,e=0,f=[],g={};SC.beginPropertyChanges=function(){e++;return this},SC.endPropertyChanges=function(){e--,e<=0&&i()},SC.addObserver=function(a,b,c,e){b=d(b),SC.addListener(a,j(b),c,e,n),SC.watch(a,b);return this},SC.observersFor=function(a,b){return SC.listenersFor(a,j(b))},SC.removeObserver=function(a,b,c,e){b=d(b),SC.unwatch(a,b),SC.removeListener(a,j(b),c,e);return this},SC.addBeforeObserver=function(a,b,c,e){b=d(b),SC.addListener(a,k(b),c,e,o),SC.watch(a,b);return this},SC.beforeObserversFor=function(a,b){return SC.listenersFor(a,k(b))},SC.removeBeforeObserver=function(a,b,c,e){b=d(b),SC.unwatch(a,b),SC.removeListener(a,k(b),c,e);return this},SC.notifyObservers=function(a,b){h(a,j(b))},SC.notifyBeforeObservers=function(a,b){h(a,k(b))}}(),function(){function D(a,b){B(a,b,"didChange")}function C(a,b){B(a,b,"willChange")}function B(a,c,d){var e=b(a,!1),f=e.chainWatchers;if(!!f&&f.__scproto__===a){f=f[c];if(!f)return;for(var g in f){if(!f.hasOwnProperty(g))continue;f[g][d](a,c)}}}function A(a){var c=b(a),d=c.chains;d?d._value!==a&&(d=c.chains=d.copy(a)):d=c.chains=new y(null,null,a);return d}function x(a){return b(a,!1).proto===a}function w(a){if(v.length!==0){var b=v;v=[],b.forEach(function(a){a[0].add(a[1])}),a!==!1&&v.length>0&&setTimeout(w,1)}}function u(c,d,e){if(!!c&&"object"==typeof c){var f=b(c,!1),g=f.chainWatchers;if(!g||g.__scproto__!==c)return;g[d]&&delete g[d][a(e)],SC.unwatch(c,d)}}function t(c,d,e){if(!!c&&"object"==typeof c){var f=b(c),g=f.chainWatchers;if(!g||g.__scproto__!==c)g=f.chainWatchers={__scproto__:c};g[d]||(g[d]={}),g[d][a(e)]=e,SC.watch(c,d)}}function s(a,b){var c=q,d=!c;d&&(c=q={}),o("propertyDidChange",a,b,c),d&&(q=null)}function r(a,b){var c=p,d=!c;d&&(c=p={}),o("propertyWillChange",a,b,c),d&&(p=null)}function o(c,d,e,f){var g=a(d);f[g]||(f[g]={});if(!f[g][e]){f[g][e]=!0;var h=b(d,!1).deps,i=SC[c];h=h&&h[e];if(h)for(var j in h){if(n[j])continue;i(d,j)}}}function m(a){return a==="*"||!k.test(a)}function l(a){return a.match(j)[0]}var a=SC.guidFor,b=SC.meta,c=SC.get,d=SC.set,e=SC.normalizeTuple.primitive,f=SC.normalizePath,g=SC.SIMPLE_PROPERTY,h=SC.GUID_KEY,i=SC.notifyObservers,j=/^([^\.\*]+)/,k=/[\.\*]/,n={__scproto__:!0},p,q,v=[],y=function(a,b,d,e){var f;this._parent=a,this._key=b,this._watching=d===undefined,this._value=d||a._value&&!x(a._value)&&c(a._value,b),this._separator=e||".",this._paths={},this._watching&&(this._object=a._value,this._object&&t(this._object,this._key,this))},z=y.prototype;z.destroy=function(){if(this._watching){var a=this._object;a&&u(a,this._key,this),this._watching=!1}},z.copy=function(a){var b=new y(null,null,a,this._separator),c=this._paths,d;for(d in c){if(!(c[d]>0))continue;b.add(d)}return b},z.add=function(a){var b,c,d,f,g,h;h=this._paths,h[a]=(h[a]||0)+1,b=this._value,c=e(b,a);if(c[0]&&c[0]===b)a=c[1],d=l(a),a=a.slice(d.length+1);else{if(!c[0]){v.push([this,a]);return}f=c[0],d=a.slice(0,0-(c[1].length+1)),g=a.slice(d.length,d.length+1),a=c[1]}this.chain(d,a,f,g)},z.remove=function(a){var b,c,d,f,g;g=this._paths,g[a]>0&&g[a]--,b=this._value,c=e(b,a),c[0]===b?(a=c[1],d=l(a),a=a.slice(d.length+1)):(f=c[0],d=a.slice(0,0-(c[1].length+1)),a=c[1]),this.unchain(d,a)},z.count=0,z.chain=function(a,b,c,d){var e=this._chains,f;e||(e=this._chains={}),f=e[a],f||(f=e[a]=new y(this,a,c,d)),f.count++,b&&b.length>0&&(a=l(b),b=b.slice(a.length+1),f.chain(a,b))},z.unchain=function(a,b){var c=this._chains,d=c[a];b&&b.length>1&&(a=l(b),b=b.slice(a.length+1),d.unchain(a,b)),d.count--,d.count<=0&&(delete c[d._key],d.destroy())},z.willChange=function(){var a=this._chains;if(a)for(var b in a){if(!a.hasOwnProperty(b))continue;a[b].willChange()}this._parent&&this._parent.chainWillChange(this,this._key,1)},z.chainWillChange=function(a,b,c){this._key&&(b=this._key+this._separator+b),this._parent?this._parent.chainWillChange(this,b,c+1):(c>1&&SC.propertyWillChange(this._value,b),b="this."+b,this._paths[b]>0&&SC.propertyWillChange(this._value,b))},z.chainDidChange=function(a,b,c){this._key&&(b=this._key+this._separator+b),this._parent?this._parent.chainDidChange(this,b,c+1):(c>1&&SC.propertyDidChange(this._value,b),b="this."+b,this._paths[b]>0&&SC.propertyDidChange(this._value,b))},z.didChange=function(){if(this._watching){var a=this._parent._value;a!==this._object&&(u(this._object,this._key,this),this._object=a,t(a,this._key,this)),this._value=a&&!x(a)?c(a,this._key):undefined}var b=this._chains;if(b)for(var d in b){if(!b.hasOwnProperty(d))continue;b[d].didChange()}this._parent&&this._parent.chainDidChange(this,this._key,1)};var E=SC.SIMPLE_PROPERTY.watched;SC.watch=function(a,c){if(c==="length"&&SC.typeOf(a)==="array")return this;var d=b(a),e=d.watching,g;c=f(c),e[c]?e[c]=(e[c]||0)+1:(e[c]=1,m(c)?(g=d.descs[c],g=g?g.watched:E,g&&SC.defineProperty(a,c,g)):A(a).add(c));return this},SC.watch.flushPending=w,SC.unwatch=function(a,c){if(c==="length"&&SC.typeOf(a)==="array")return this;var d=b(a).watching,e,h;c=f(c),d[c]===1?(d[c]=0,m(c)?(e=b(a).descs[c],e=e?e.unwatched:g,e&&SC.defineProperty(a,c,e)):A(a).remove(c)):d[c]>1&&d[c]--;return this},SC.rewatch=function(a){var c=b(a,!1),d=c.chains,e=c.bindings,f,g;h in a&&!a.hasOwnProperty(h)&&SC.generateGuid(a,"sc"),d&&d._value!==a&&A(a);if(e&&c.proto!==a)for(f in e)g=!n[f]&&a[f],g&&g instanceof SC.Binding&&g.fromDidChange(a);return this},SC.propertyWillChange=function(a,c){var d=b(a,!1),e=d.proto,f=d.descs[c];e!==a&&(f&&f.willChange&&f.willChange(a,c),r(a,c),C(a,c),SC.notifyBeforeObservers(a,c))},SC.propertyDidChange=function(a,c){var d=b(a,!1),e=d.proto,f=d.descs[c];e!==a&&(f&&f.didChange&&f.didChange(a,c),s(a,c),D(a,c),SC.notifyObservers(a,c))}}(),function(){function w(a,b,c){var d=a.length;for(var f in b){if(!b.hasOwnProperty(f))continue;var g=b[f];a[d]=f;if(g&&g.toString===e)g[v]=a.join(".");else if(f==="SC"||g instanceof SC.Namespace){if(c[SC.guidFor(g)])continue;c[SC.guidFor(g)]=!0,w(a,g,c)}}a.length=d}function u(a,b,c){if(!c[SC.guidFor(b)]){c[SC.guidFor(b)]=!0;if(b.properties){var d=b.properties;for(var e in d)d.hasOwnProperty(e)&&(a[e]=!0)}else b.mixins&&b.mixins.forEach(function(b){u(a,b,c)})}}function t(a,b,c){var d=SC.guidFor(a);if(c[d])return!1;c[d]=!0;if(a===b)return!0;var e=a.mixins,f=e?e.length:0;while(--f>=0)if(t(e[f],b,c))return!0;return!1}function r(a,e,f){var g={},j={},k=SC.meta(a),l=k.required,r,s,t,u,v,w=SC._mixinBindings;m(e,i(a),g,j,a),b.detect(a)&&(s=j.willApplyProperty||a.willApplyProperty,t=j.didApplyProperty||a.didApplyProperty);for(r in g){if(!g.hasOwnProperty(r))continue;v=g[r],u=j[r];if(v===c){if(!(r in a)){if(!f)throw new Error("Required property not defined: "+r);l=o(a),l.__sc_count__++,l[r]=!0}}else{while(v instanceof d){var x=v.methodName;g[x]?(u=j[x],v=g[x]):k.descs[x]?(v=k.descs[x],u=v.val(a,x)):(u=a[x],v=SC.SIMPLE_PROPERTY)}s&&s.call(a,r);var y=p(u),z=y&&p(a[r]),A=q(u),B=A&&q(a[r]),C,D;if(z){C=z.length;for(D=0;D0){var E=[];for(r in l){if(h[r])continue;E.push(r)}throw new Error("Required properties not defined: "+E.join(","))}return a}function q(a){return"function"==typeof a&&a.__sc_observesBefore__}function p(a){return"function"==typeof a&&a.__sc_observes__}function o(a){var b=SC.meta(a),c=b.required;if(!c||c.__scproto__!==a)c=b.required=c?Object.create(c):{__sc_count__:0},c.__scproto__=a;return c}function m(b,d,e,f,g){function s(a){delete e[a],delete f[a]}var h=b.length,i,j,k,n,o,p,q,r;for(i=0;i=0||p==="concatenatedProperties"){var v=f[p]||g[p];o=v?v.concat(o):SC.makeArray(o)}e[p]=SC.SIMPLE_PROPERTY,f[p]=o}}}else j.mixins&&(m(j.mixins,d,e,f,g),j._without&&j._without.forEach(s))}}function l(a){if("function"!=typeof a||a.isMethod===!1)return!1;return k.indexOf(a)<0}function j(b,c){c&&c.length>0&&(b.mixins=f.call(c,function(b){if(b instanceof a)return b;var c=new a;c.properties=b;return c}));return b}function i(a,b){var c=SC.meta(a,b!==!1),d=c.mixins;if(b===!1)return d||g;d?d.__scproto__!==a&&(d=c.mixins=Object.create(d),d.__scproto__=a):d=c.mixins={__scproto__:a};return d}var a,b,c,d,e,f=Array.prototype.map,g={},h={__scproto__:!0,__sc_count__:!0},k=[Boolean,Object,Number,Array,Date,String],n=SC.defineProperty;SC._mixinBindings=function(a,b,c,d){return c},SC.mixin=function(a){var b=Array.prototype.slice.call(arguments,1);return r(a,b,!1)},a=function(){return j(this,arguments)},a._apply=r,a.applyPartial=function(a){var b=Array.prototype.slice.call(arguments,1);return r(a,b,!0)},a.create=function(){e.processed=!1;var a=this;return j(new a,arguments)},a.prototype.reopen=function(){var b,c;this.properties&&(b=a.create(),b.properties=this.properties,delete this.properties,this.mixins=[b]);var d=arguments.length,e=this.mixins,f;for(f=0;f=0)return e[g];sc_assert("Cannot clone an SC.Object that does not implement SC.Copyable",!(a instanceof SC.Object)||SC.Copyable&&SC.Copyable.detect(a));if(SC.typeOf(a)==="array"){f=a.slice();if(b){g=f.length;while(--g>=0)f[g]=d(f[g],b,c,e)}}else if(SC.Copyable&&SC.Copyable.detect(a))f=a.copy(b,c,e);else{f={};for(h in a){if(!a.hasOwnProperty(h))continue;f[h]=b?d(a[h],b,c,e):a[h]}}b&&(c.push(a),e.push(f));return f}YES=!0,NO=!1,typeof console=="undefined"&&(window.console={},console.log=console.info=console.warn=console.error=function(){}),SC.EXTEND_PROTOTYPES=SC.ENV.EXTEND_PROTOTYPES!==!1;var a={},b="Boolean Number String Function Array Date RegExp Object".split(" ");b.forEach(function(b){a["[object "+b+"]"]=b.toLowerCase()});var c=Object.prototype.toString;SC.typeOf=function(b){var d;d=b==null?String(b):a[c.call(b)]||"object",d==="function"?SC.Object&&SC.Object.detect(b)&&(d="class"):d==="object"&&(b instanceof Error?d="error":SC.Object&&b instanceof SC.Object?d="instance":d="object");return d},SC.none=function(a){return a===null||a===undefined},SC.empty=function(a){return a===null||a===undefined||a===""},SC.isArray=function(a){if(!a||a.setInterval)return!1;if(Array.isArray&&Array.isArray(a))return!0;if(SC.Array&&SC.Array.detect(a))return!0;if(a.length!==undefined&&"object"==typeof a)return!0;return!1},SC.compare=function(a,b){if(a===b)return 0;var c=SC.typeOf(a),d=SC.typeOf(b),e=SC.Comparable;if(e){if(c==="instance"&&e.detect(a.constructor))return a.constructor.compare(a,b);if(d==="instance"&&e.detect(b.constructor))return 1-b.constructor.compare(b,a)}var f=SC.ORDER_DEFINITION_MAPPING;if(!f){var g=SC.ORDER_DEFINITION;f=SC.ORDER_DEFINITION_MAPPING={};var h,i;for(h=0,i=g.length;hk)return 1;switch(c){case"boolean":case"number":if(ab)return 1;return 0;case"string":var l=a.localeCompare(b);if(l<0)return-1;if(l>0)return 1;return 0;case"array":var m=a.length,n=b.length,o=Math.min(m,n),p=0,q=0,r=arguments.callee;while(p===0&&qn)return 1;return 0;case"instance":if(SC.Comparable&&SC.Comparable.detect(a))return a.compare(a,b);return 0;default:return 0}},SC.copy=function(a,b){if("object"!=typeof a)return a;if(SC.Copyable&&SC.Copyable.detect(a))return a.copy(b);return d(a,b,b?[]:null,b?[]:null)},SC.inspect=function(a){var b,c=[];for(var d in a)if(a.hasOwnProperty(d)){b=a[d];if(b==="toString")continue;SC.typeOf(b)===SC.T_FUNCTION&&(b="function() { ... }"),c.push(d+": "+b)}return"{"+c.join(" , ")+"}"},SC.isEqual=function(a,b){if(a&&"function"==typeof a.isEqual)return a.isEqual(b);return a===b},SC.ORDER_DEFINITION=SC.ENV.ORDER_DEFINITION||["undefined","null","boolean","number","string","array","object","instance","function","class"],SC.keys=Object.keys,SC.keys||(SC.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),SC.K=function(){return this},SC.Error=function(){var a=Error.prototype.constructor.apply(this,arguments);for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b])},SC.Error.prototype=SC.create(Error.prototype),SC.Logger=window.console,"undefined"==typeof require&&(require=SC.K)}(),function(){SC.EXTEND_PROTOTYPES&&(Function.prototype.property=function(){var a=SC.computed(this);return a.property.apply(a,arguments)},Function.prototype.observes=function(){this.__sc_observes__=Array.prototype.slice.call(arguments);return this},Function.prototype.observesBefore=function(){this.__sc_observesBefore__=Array.prototype.slice.call(arguments);return this})}(),function(){var a=/^.+Binding$/;SC._mixinBindings=function(b,c,d,e){if(a.test(c)){d instanceof SC.Binding?d.to(c.slice(0,-7)):d=new SC.Binding(c.slice(0,-7),d),d.connect(b);var f=e.bindings;f?f.__scproto__!==b&&(f=e.bindings=SC.create(e.bindings),f.__scproto__=b):f=e.bindings={__scproto__:b},f[c]=!0}return d}}(),function(){var a=/[ _]/g,b={},c=/([a-z])([A-Z])/g;SC.STRINGS={},SC.String={fmt:function(a,b){var c=0;return a.replace(/%@([0-9]+)?/g,function(a,d){d=d?parseInt(d,0)-1:c++,a=b[d];return(a===null?"(null)":a===undefined?"":a).toString()})},loc:function(a,b){a=SC.STRINGS[a]||a;return SC.String.fmt(a,b)},w:function(a){return a.split(/\s+/)},decamelize:function(a){return a.replace(c,"$1_$2").toLowerCase()},dasherize:function(c){var d=b,e=d[c];if(e)return e;e=SC.String.decamelize(c).replace(a,"-"),d[c]=e;return e}}}(),function(){var a=SC.String.fmt,b=SC.String.w,c=SC.String.loc,d=SC.String.decamelize,e=SC.String.dasherize;SC.EXTEND_PROTOTYPES&&(String.prototype.fmt=function(){return a(this,arguments)},String.prototype.w=function(){return b(this)},String.prototype.loc=function(){return c(this,arguments)},String.prototype.decamelize=function(){return d(this)},String.prototype.dashersize=function(){return e(this)})}(),function(){}(),function(){}(),function(){function g(a,b,c){b.call(a,c[0],c[2],c[3])}function f(b,c){function d(d){var e=a(d,b);return c===undefined?!!e:c===e}return d}function e(a){c.push(a);return null}function d(){return c.length===0?{}:c.pop()}var a=SC.get,b=SC.set,c=[];SC.Enumerable=SC.Mixin.create({isEnumerable:!0,nextObject:SC.required(Function),firstObject:SC.computed(function(){if(a(this,"length")===0)return undefined;if(SC.Array&&SC.Array.detect(this))return this.objectAt(0);var b=d(),c;c=this.nextObject(0,null,b),e(b);return c}).property("[]").cacheable(),lastObject:SC.computed(function(){var b=a(this,"length");if(b===0)return undefined;if(SC.Array&&SC.Array.detect(this))return this.objectAt(b-1);var c=d(),f=0,g,h=null;do h=g,g=this.nextObject(f++,h,c);while(g!==undefined);e(c);return h}).property("[]").cacheable(),contains:function(a){return this.find(function(b){return b===a})!==undefined},forEach:function(b,c){if(typeof b!="function")throw new TypeError;var f=a(this,"length"),g=null,h=d();c===undefined&&(c=null);for(var i=0;i1&&(b=Array.prototype.slice.call(arguments,1)),this.forEach(function(d,e){var f=d&&d[a];"function"==typeof f&&(c[e]=b?f.apply(d,b):f.call(d))},this);return c},toArray:function(){var a=[];this.forEach(function(b,c){a[c]=b});return a},compact:function(){return this.without(null)},without:function(a){if(!this.contains(a))return this;var b=[];this.forEach(function(c){c!==a&&(b[b.length]=c)});return b},uniq:function(){var a=[],b=!1;this.forEach(function(c){a.indexOf(c)<0?a[a.length]=c:b=!0});return b?a:this},"[]":function(a,b){return this}.property().cacheable(),addEnumerableObserver:function(b,c){var d=c&&c.willChange||"enumerableWillChange",e=c&&c.didChange||"enumerableDidChange",f=a(this,"hasEnumerableObservers");f||SC.propertyWillChange(this,"hasEnumerableObservers"),SC.addListener(this,"@enumerable:before",b,d,g),SC.addListener(this,"@enumerable:change",b,e,g),f||SC.propertyDidChange(this,"hasEnumerableObservers");return this},removeEnumerableObserver:function(b,c){var d=c&&c.willChange||"enumerableWillChange",e=c&&c.didChange||"enumerableDidChange",f=a(this,"hasEnumerableObservers");f&&SC.propertyWillChange(this,"hasEnumerableObservers"),SC.removeListener(this,"@enumerable:before",b,d),SC.removeListener(this,"@enumerable:change",b,e),f&&SC.propertyDidChange(this,"hasEnumerableObservers");return this},hasEnumerableObservers:function(){return SC.hasListeners(this,"@enumerable:change")||SC.hasListeners(this,"@enumerable:before")}.property().cacheable(),enumerableContentWillChange:function(b,c){var d,e,f;"number"==typeof b?d=b:b?d=a(b,"length"):d=b=-1,"number"==typeof c?e=c:c?e=a(c,"length"):e=c=-1,f=e<0||d<0||e-d!==0,b===-1&&(b=null),c===-1&&(c=null),SC.propertyWillChange(this,"[]"),f&&SC.propertyWillChange(this,"length"),SC.sendEvent(this,"@enumerable:before",b,c);return this},enumerableContentDidChange:function(b,c){var d=this.propertyDidChange,e,f,g;"number"==typeof b?e=b:b?e=a(b,"length"):e=b=-1,"number"==typeof c?f=c:c?f=a(c,"length"):f=c=-1,g=f<0||e<0||f-e!==0,b===-1&&(b=null),c===-1&&(c=null),SC.sendEvent(this,"@enumerable:change",b,c),g&&SC.propertyDidChange(this,"length"),SC.propertyDidChange(this,"[]");return this}})}(),function(){function d(a,b,c){b.call(a,c[0],c[2],c[3],c[4])}function c(a){return a===null||a===undefined}var a=SC.get,b=SC.set;SC.Array=SC.Mixin.create(SC.Enumerable,{isSCArray:!0,length:SC.required(),objectAt:function(b){if(b<0||b>=a(this,"length"))return undefined;return a(this,b)},nextObject:function(a){return this.objectAt(a)},"[]":function(b,c){c!==undefined&&this.replace(0,a(this,"length"),c);return this}.property().cacheable(),contains:function(a){return this.indexOf(a)>=0},slice:function(b,d){var e=[],f=a(this,"length");c(b)&&(b=0);if(c(d)||d>f)d=f;while(b=0;d--)if(this.objectAt(d)===b)return d;return-1},addArrayObserver:function(b,c){var e=c&&c.willChange||"arrayWillChange",f=c&&c.didChange||"arrayDidChange",g=a(this,"hasArrayObservers");g||SC.propertyWillChange(this,"hasArrayObservers"),SC.addListener(this,"@array:before",b,e,d),SC.addListener(this,"@array:change",b,f,d),g||SC.propertyDidChange(this,"hasArrayObservers");return this},removeArrayObserver:function(b,c){var e=c&&c.willChange||"arrayWillChange",f=c&&c.didChange||"arrayDidChange",g=a(this,"hasArrayObservers");g&&SC.propertyWillChange(this,"hasArrayObservers"),SC.removeListener(this,"@array:before",b,e,d),SC.removeListener(this,"@array:change",b,f,d),g&&SC.propertyDidChange(this,"hasArrayObservers");return this},hasArrayObservers:function(){return SC.hasListeners(this,"@array:change")||SC.hasListeners(this,"@array:before")}.property().cacheable(),arrayContentWillChange:function(b,c,d){b===undefined?(b=0,c=d=-1):(c||(c=0),d||(d=0)),SC.sendEvent(this,"@array:before",b,c,d);var e,f;if(b>=0&&c>=0&&a(this,"hasEnumerableObservers")){e=[],f=b+c;for(var g=b;g=0&&d>=0&&a(this,"hasEnumerableObservers")){e=[],f=b+d;for(var g=b;gc(this,"length"))throw new Error(a);this.replace(b,0,[d]);return this},removeAt:function(d,e){var f=0;if("number"==typeof d){if(d<0||d>=c(this,"length"))throw new Error(a);e===undefined&&(e=1),this.replace(d,e,b)}return this},pushObject:function(a){this.insertAt(c(this,"length"),a);return a},pushObjects:function(a){this.beginPropertyChanges(),a.forEach(function(a){this.pushObject(a)},this),this.endPropertyChanges();return this},popObject:function(){var a=c(this,"length");if(a===0)return null;var b=this.objectAt(a-1);this.removeAt(a-1,1);return b},shiftObject:function(){if(c(this,"length")===0)return null;var a=this.objectAt(0);this.removeAt(0);return a},unshiftObject:function(a){this.insertAt(0,a);return a},unshiftObjects:function(a){this.beginPropertyChanges(),a.forEach(function(a){this.unshiftObject(a)},this),this.endPropertyChanges();return this},removeObject:function(a){var b=c(this,"length")||0;while(--b>=0){var d=this.objectAt(b);d===a&&this.removeAt(b)}return this},addObject:function(a){this.contains(a)||this.pushObject(a);return this}})}(),function(){var a=SC.get,b=SC.set;SC.Observable=SC.Mixin.create({isObserverable:!0,get:function(b){return a(this,b)},set:function(a,c){b(this,a,c);return this},setProperties:function(a){SC.beginPropertyChanges(this);for(var c in a)a.hasOwnProperty(c)&&b(this,c,a[c]);SC.endPropertyChanges(this);return this},beginPropertyChanges:function(){SC.beginPropertyChanges();return this},endPropertyChanges:function(){SC.endPropertyChanges();return this},propertyWillChange:function(a){SC.propertyWillChange(this,a);return this},propertyDidChange:function(a){SC.propertyDidChange(this,a);return this},notifyPropertyChange:function(a){this.propertyWillChange(a),this.propertyDidChange(a);return this},addObserver:function(a,b,c){SC.addObserver(this,a,b,c)},removeObserver:function(a,b,c){SC.removeObserver(this,a,b,c)},hasObserverFor:function(a){return SC.hasListeners(this,a+":change")},unknownProperty:function(a){return undefined},setUnknownProperty:function(a,b){this[a]=b},getPath:function(a){return SC.getPath(this,a)},setPath:function(a,b){SC.setPath(this,a,b);return this},incrementProperty:function(c,d){d||(d=1),b(this,c,(a(this,c)||0)+d);return a(this,c)},decrementProperty:function(c,d){d||(d=1),b(this,c,(a(this,c)||0)-d);return a(this,c)},toggleProperty:function(c){b(this,c,!a(this,c));return a(this,c)},observersForKey:function(a){return SC.observersFor(this,a)}})}(),function(){}(),function(){function g(){var c=!1,e,g=!1,h=!1,i=function(){c||d(i,"proto"),e?(this.reopen.apply(this,e),e=null,a(this),this.init.apply(this,arguments)):(h&&a(this),g===!1&&(g=this.init),g.apply(this,arguments))};i.toString=b,i._prototypeMixinDidChange=function(){c=!1},i._initMixins=function(a){e=a},SC.defineProperty(i,"proto",SC.computed(function(){c||(c=!0,i.PrototypeMixin.applyPartial(i.prototype),h=!!f(i.prototype,!1).chains);return this.prototype}));return i}var a=SC.rewatch,b=SC.Mixin.prototype.toString,c=SC.set,d=SC.get,e=SC.platform.create,f=SC.meta,h=g();h.PrototypeMixin=SC.Mixin.create({reopen:function(){SC.Mixin._apply(this,arguments,!0);return this},init:function(){},isDestroyed:!1,destroy:function(){c(this,"isDestroyed",!0);return this},bind:function(a,b){b instanceof SC. 10 | Binding||(b=SC.Binding.from(b)),b.to(a).connect(this);return b},toString:function(){return"<"+this.constructor.toString()+":"+SC.guidFor(this)+">"}}),h.__super__=null;var i=SC.Mixin.create({ClassMixin:SC.required(),PrototypeMixin:SC.required(),isMethod:!1,extend:function(){var a=g(),b;a.ClassMixin=SC.Mixin.create(this.ClassMixin),a.PrototypeMixin=SC.Mixin.create(this.PrototypeMixin);var c=a.PrototypeMixin;c.reopen.apply(c,arguments),a.superclass=this,a.__super__=this.prototype,b=a.prototype=e(this.prototype),b.constructor=a,SC.generateGuid(b,"sc"),f(b).proto=b,SC.rewatch(b),a.subclasses=SC.Set?new SC.Set:null,this.subclasses&&this.subclasses.add(a),a.ClassMixin.apply(a);return a},create:function(){var a=this;arguments.length>0&&this._initMixins(arguments);return new a},reopen:function(){var a=this.PrototypeMixin;a.reopen.apply(a,arguments),this._prototypeMixinDidChange();return this},reopenClass:function(){var a=this.ClassMixin;a.reopen.apply(a,arguments),SC.Mixin._apply(this,arguments,!1);return this},detect:function(a){if("function"!=typeof a)return!1;while(a){if(a===this)return!0;a=a.superclass}return!1}});h.ClassMixin=i,i.apply(h),SC.CoreObject=h}(),function(){var a=SC.get,b=SC.set,c=SC.guidFor,d=SC.none;SC.Set=SC.CoreObject.extend(SC.MutableEnumerable,SC.Copyable,SC.Freezable,{length:0,clear:function(){if(this.isFrozen)throw new Error(SC.FROZEN_ERROR);var c=a(this,"length");this.enumerableContentWillChange(c,0),b(this,"length",0),this.enumerableContentDidChange(c,0);return this},isEqual:function(b){if(!SC.Enumerable.detect(b))return!1;var c=a(this,"length");if(a(b,"length")!==c)return!1;while(--c>=0)if(!b.contains(this[c]))return!1;return!0},add:SC.alias("addObject"),remove:SC.alias("removeObject"),pop:function(){if(a(this,"isFrozen"))throw new Error(SC.FROZEN_ERROR);var b=this.length>0?this[this.length-1]:null;this.remove(b);return b},push:SC.alias("addObject"),shift:SC.alias("pop"),unshift:SC.alias("push"),addEach:SC.alias("addObjects"),removeEach:SC.alias("removeObjects"),init:function(a){this._super(),a&&this.addObjects(a)},nextObject:function(a){return this[a]},firstObject:function(){return this.length>0?this[0]:undefined}.property("[]").cacheable(),lastObject:function(){return this.length>0?this[this.length-1]:undefined}.property("[]").cacheable(),addObject:function(e){if(a(this,"isFrozen"))throw new Error(SC.FROZEN_ERROR);if(d(e))return this;var f=c(e),g=this[f],h=a(this,"length"),i;if(g>=0&&g=0&&g=0},copy:function(){var d=this.constructor,e=new d,f=a(this,"length");b(e,"length",f);while(--f>=0)e[f]=this[f],e[c(this[f])]=f;return e},toString:function(){var a=this.length,b,c=[];for(b=0;b".fmt(c.join(","))},isSet:YES});var e=SC.Set.create;SC.Set.create=function(a){if(a&&SC.Enumerable.detect(a)){SC.Logger.warn("Passing an enumerable to SC.Set.create() is deprecated and will be removed in a future version of SproutCore. Use new SC.Set(items) instead");return new SC.Set(a)}return e.apply(this,arguments)}}(),function(){SC.CoreObject.subclasses=new SC.Set,SC.Object=SC.CoreObject.extend(SC.Observable)}(),function(){SC.Namespace=SC.Object.extend()}(),function(){SC.Application=SC.Namespace.extend()}(),function(){var a=SC.get,b=SC.set;SC.ArrayProxy=SC.Object.extend(SC.MutableArray,{content:null,objectAtContent:function(b){return a(this,"content").objectAt(b)},replaceContent:function(b,c,d){a(this,"content").replace(b,c,d)},contentWillChange:function(){var b=a(this,"content"),c=b?a(b,"length"):0;this.arrayWillChange(b,0,c,undefined),b&&b.removeArrayObserver(this)}.observesBefore("content"),contentDidChange:function(){var b=a(this,"content"),c=b?a(b,"length"):0;b&&b.addArrayObserver(this),this.arrayDidChange(b,0,undefined,c)}.observes("content"),objectAt:function(b){return a(this,"content")&&this.objectAtContent(b)},length:function(){var b=a(this,"content");return b?a(b,"length"):0}.property("content.length").cacheable(),replace:function(b,c,d){a(this,"content")&&this.replaceContent(b,c,d);return this},arrayWillChange:function(a,b,c,d){this.arrayContentWillChange(b,c,d)},arrayDidChange:function(a,b,c,d){this.arrayContentDidChange(b,c,d)},init:function(a){this._super(),a&&b(this,"content",a),this.contentDidChange()}})}(),function(){function m(){l=null;for(var a in h){if(!h.hasOwnProperty(a))continue;var c=h[a];c.next&&(delete h[a],b(c.target,c.method,c.args,2))}}function k(a,c){c[this.tguid]&&delete c[this.tguid][this.mguid],h[a]&&b(this.target,this.method,this.args,2),delete h[a]}function j(){var a=Date.now(),c=-1;for(var d in h){if(!h.hasOwnProperty(d))continue;var e=h[d];if(e&&e.expires)if(a>=e.expires)delete h[d],b(e.target,e.method,e.args,2);else if(c<0||e.expires0&&setTimeout(j,c-Date.now())}function g(){f=null,e.currentRunLoop&&e.end()}function b(b,c,d,e){c===undefined&&(c=b,b=undefined),"string"==typeof c&&(c=b[c]),d&&e>0&&(d=d.length>e?a.call(d,e):null);return c.apply(b,d)}var a=Array.prototype.slice,c,d=SC.Object.extend({_prev:null,init:function(a){this._prev=a,this.onceTimers={}},end:function(){this.flush();return this._prev},schedule:function(b,c,d){var e=this._queues,f;e||(e=this._queues={}),f=e[b],f||(f=e[b]=[]);var g=arguments.length>3?a.call(arguments,3):null;f.push({target:c,method:d,args:g});return this},flush:function(a){function j(a){b(a.target,a.method,a.args)}var d=this._queues,e,f,g,h,i;if(!d)return this;SC.watch.flushPending();if(a)while(this._queues&&(h=this._queues[a]))this._queues[a]=null,i=SC.LOG_BINDINGS&&a==="sync",i&&SC.Logger.log("Begin: Flush Sync Queue"),a==="sync"&&SC.beginPropertyChanges(),h.forEach(j),a==="sync"&&SC.endPropertyChanges(),i&&SC.Logger.log("End: Flush Sync Queue");else{e=SC.run.queues,g=e.length;do{this._queues=null;for(f=0;f1?b:a[0];return a}function a(a){if(a instanceof Array)return a;if(a===undefined||a===null)return[];return[a]}SC.LOG_BINDINGS=!1||!!SC.ENV.LOG_BINDINGS,SC.BENCHMARK_BINDING_NOTIFICATIONS=!!SC.ENV.BENCHMARK_BINDING_NOTIFICATIONS,SC.BENCHMARK_BINDING_SETUP=!!SC.ENV.BENCHMARK_BINDING_SETUP,SC.MULTIPLE_PLACEHOLDER="@@MULT@@",SC.EMPTY_PLACEHOLDER="@@EMPTY@@";var e=SC.get,f=SC.getPath,g=SC.setPath,h=SC.guidFor,l=function(a,b,c){return f(a,b)&&f(a,c)},m=function(a,b,c){return f(a,b)||f(a,c)},n=SC.Object.extend({_direction:"fwd",init:function(a,b){this._from=b,this._to=a},from:function(a){this._from=a;return this},to:function(a){this._to=a;return this},oneWay:function(a){this._oneWay=a===undefined?!0:!!a;return this},transform:function(a){this._transforms||(this._transforms=[]),this._transforms.push(a);return this},resetTransforms:function(){this._transforms=null;return this},single:function(a){a===undefined&&(a=SC.MULTIPLE_PLACEHOLDER),this._forceKind=b,this._placeholder=a;return this},multiple:function(){this._forceKind=a,this._placeholder=null;return this},bool:function(){this.transform(c);return this},notEmpty:function(a,b){b&&(a&&this.from(a),a=b),a||(a=SC.EMPTY_PLACEHOLDER),this.transform(function(b){return j(b)?a:b});return this},notNull:function(a){throw new Error("SC.Binding.notNull not yet implemented")},not:function(){this.transform(d);return this},isNull:function(a){throw new Error("SC.Binding.isNull not yet implemented")},toString:function(){var a=this._oneWay?"[oneWay]":"";return SC.String.fmt("SC.Binding<%@>(%@ -> %@)%@",[h(this),this._from,this._to,a])},connect:function(a){sc_assert("Must pass a valid object to SC.Binding.connect()",!!a);var b=this._oneWay,c=this._from2;SC.addObserver(a,this._from,this,this.fromDidChange),c&&SC.addObserver(a,c,this,this.fromDidChange),b||SC.addObserver(a,this._to,this,this.toDidChange),SC.meta(a,!1).proto!==a&&this._scheduleSync(a,"fwd"),this._readyToSync=!0;return this},disconnect:function(a){sc_assert("Must pass a valid object to SC.Binding.disconnect()",!!a);var b=this._oneWay,c=this._from2;SC.removeObserver(a,this._from,this,this.fromDidChange),c&&SC.removeObserver(a,c,this,this.fromDidChange),b||SC.removeObserver(a,this._to,this,this.toDidChange),this._readyToSync=!1;return this},fromDidChange:function(a){this._scheduleSync(a,"fwd")},toDidChange:function(a){this._scheduleSync(a,"back")},_scheduleSync:function(a,b){var c=h(a);this[c]||SC.run.schedule("sync",this,this._sync,a),this[c]=this[c]==="fwd"||!b?"fwd":b},_sync:function(a){var b=SC.LOG_BINDINGS,c=h(a),d=this[c],e,g;!this._readyToSync||(delete this[c],d==="fwd"?(e=k(a,this),g=i(this,e,a),b&&SC.Logger.log(" ",this.toString(),e,"->",g,a),SC.setPath(a,this._to,g)):d==="back"&&!this._oneWay&&(e=f(a,this._to),g=i(this,k(a,this),a),e!==g&&(b&&SC.Logger.log(" ",this.toString(),e,"<-",g,a),SC.setPath(a,this._from,e))))}});n.reopenClass({from:function(){var a=this,b=new a;return b.from.apply(b,arguments)},to:function(){var a=this,b=new a;return b.to.apply(b,arguments)},oneWay:function(a,b){var c=this,d=new c(null,a);return d.oneWay(b)},single:function(a){var b=this,c=new b(null,a);return c.single()},multiple:function(a){var b=this,c=new b(null,a);return c.multiple()},oneWay:function(a,b){var c=this,d=new c(null,a);return d.oneWay(b)},transform:function(a){var b=this,c=new b;return c.transform(a)},notEmpty:function(a,b){var c=this,d=new c(null,a);return d.notEmpty(b)},bool:function(a){var b=this,c=new b(null,a);return c.bool()},not:function(a){var b=this,c=new b(null,a);return c.not()},and:function(a,b){var c=this,d=(new c(null,a)).oneWay();d._from2=b,d._logic=l;return d},or:function(a,b){var c=this,d=(new c(null,a)).oneWay();d._from2=b,d._logic=m;return d}}),SC.Binding=n,SC.bind=function(a,b,c){return(new SC.Binding(b,c)).connect(a)}}(),function(){function g(a,b,d,e,f){var g=d._objects;g||(g=d._objects={});var h,i;while(--f>=e){var j=a.objectAt(f);j&&(SC.removeBeforeObserver(j,b,d,"contentKeyWillChange"),SC.removeObserver(j,b,d,"contentKeyDidChange"),i=c(j),h=g[i],h[h.indexOf(f)]=null)}}function f(a,b,d,e,f){var g=d._objects,h;g||(g=d._objects={});while(--f>=e){var i=a.objectAt(f);i&&(SC.addBeforeObserver(i,b,d,"contentKeyWillChange"),SC.addObserver(i,b,d,"contentKeyDidChange"),h=c(i),g[h]||(g[h]=[]),g[h].push(f))}}var a=SC.set,b=SC.get,c=SC.guidFor,d=SC.Object.extend(SC.Array,{init:function(a,b,c){this._super(),this._keyName=b,this._owner=c,this._content=a},objectAt:function(a){var c=this._content.objectAt(a);return c&&b(c,this._keyName)},length:function(){var a=this._content;return a?b(a,"length"):0}.property("[]").cacheable()}),e=/^.+:(before|change)$/;SC.EachProxy=SC.Object.extend({init:function(a){this._super(),this._content=a,a.addArrayObserver(this),SC.watchedEvents(this).forEach(function(a){this.didAddListener(a)},this)},unknownProperty:function(b){var c;c=new d(this._content,b,this),a(this,b,c),this.beginObservingContentKey(b);return c},arrayWillChange:function(a,c,d,e){var f=this._keys,h,i,j;if(!!f){j=d>0?c+d:-1,SC.beginPropertyChanges(this);for(h in f){if(!f.hasOwnProperty(h))continue;j>0&&g(a,h,this,c,j),i=b(this,h),SC.propertyWillChange(this,h),i&&i.arrayContentWillChange(c,d,e)}SC.endPropertyChanges(this)}},arrayDidChange:function(a,c,d,e){var g=this._keys,h,i,j;if(!!g){j=e>0?c+e:-1,SC.beginPropertyChanges(this);for(h in g){if(!g.hasOwnProperty(h))continue;j>0&&f(a,h,this,c,j),i=b(this,h),i&&i.arrayContentDidChange(c,d,e),SC.propertyDidChange(this,h)}SC.endPropertyChanges(this)}},didAddListener:function(a){e.test(a)&&this.beginObservingContentKey(a.slice(0,-7))},didRemoveListener:function(a){e.test(a)&&this.stopObservingContentKey(a.slice(0,-7))},beginObservingContentKey:function(a){var c=this._keys;c||(c=this._keys={});if(!c[a]){c[a]=1;var d=this._content,e=b(d,"length");f(d,a,this,0,e)}else c[a]++},stopObservingContentKey:function(a){var c=this._keys;if(c&&c[a]>0&&--c[a]<=0){var d=this._content,e=b(d,"length");g(d,a,this,0,e)}},contentKeyWillChange:function(a,d){var e=this._objects[c(a)],f=b(this,d),g=f&&e?e.length:0,h;for(h=0;h=0;c--)if(this[c]===a)return c;return-1},copy:function(){return this.slice()}}),d=["length"];c.keys().forEach(function(a){Array.prototype[a]&&d.push(a)}),d.length>0&&(c=c.without.apply(c,d)),SC.NativeArray=c,SC.NativeArray.activate=function(){c.apply(Array.prototype)},SC.EXTEND_PROTOTYPES&&SC.NativeArray.activate()}(),function(){}(),function(){}(),function(){var a=SC.get,b=SC.set;SC.RenderBuffer=function(a){return SC._RenderBuffer.create({elementTag:a})},SC._RenderBuffer=SC.Object.extend({elementClasses:null,elementId:null,elementAttributes:null,elementContent:null,elementTag:null,elementStyle:null,escapeContent:!1,escapeFunction:null,parentBuffer:null,init:function(){this._super(),b(this,"elementClasses",[]),b(this,"elementAttributes",{}),b(this,"elementStyle",{}),b(this,"elementContent",[])},push:function(b){a(this,"elementContent").pushObject(b);return this},addClass:function(b){a(this,"elementClasses").pushObject(b);return this},id:function(a){b(this,"elementId",a);return this},attr:function(b,c){a(this,"elementAttributes")[b]=c;return this},style:function(b,c){a(this,"elementStyle")[b]=c;return this},begin:function(a){return SC._RenderBuffer.create({parentBuffer:this,elementTag:a})},end:function(){var b=a(this,"parentBuffer");if(b){var c=this.string();b.push(c);return b}return this},element:function(){return SC.$(this.string())[0]},string:function(){var b=a(this,"elementId"),c=a(this,"elementClasses"),d=a(this,"elementAttributes"),e=a(this,"elementStyle"),f=a(this,"elementContent"),g=a(this,"elementTag"),h=[],i,j=["<"+g];b&&j.push('id="'+b+'"'),c.length&&j.push('class="'+c.join(" ")+'"');if(!jQuery.isEmptyObject(e)){for(i in e)e.hasOwnProperty(i)&&h.push(i+":"+e[i]+";");j.push('style="'+h.join()+'"')}for(i in d)d.hasOwnProperty(i)&&j.push(i+'="'+d[i]+'"');j.push(">"),j=j.join(" "),f=f.join(),a(this,"escapeContent")&&(f=a(this,"escapeFunction")(f));return j+f+""}})}(),function(){var a=SC.get,b=SC.set;SC.EventDispatcher=SC.Object.extend({rootElement:document,setup:function(){var a,b={touchstart:"touchStart",touchmove:"touchMove",touchend:"touchEnd",touchcancel:"touchCancel",keydown:"keyDown",keyup:"keyUp",keypress:"keyPress",mousedown:"mouseDown",mouseup:"mouseUp",click:"click",dblclick:"doubleClick",mousemove:"mouseMove",focusin:"focusIn",focusout:"focusOut",mouseenter:"mouseEnter",mouseleave:"mouseLeave",change:"change"};for(a in b)b.hasOwnProperty(a)&&this.setupHandler(a,b[a])},setupHandler:function(b,c){var d=a(this,"rootElement");SC.$(d).delegate(".sc-view",b+".sproutcore",function(b){var d=SC.View.views[this.id],e=!0,f;SC.run(function(){while(e!==!1&&d)f=d[c],SC.typeOf(f)==="function"&&(e=f.call(d,b)),d=a(d,"parentView")});return e})},destroy:function(){var b=a(this,"rootElement");SC.$(b).undelegate(".sproutcore")}})}(),function(){var a=SC.get,b=SC.set;SC.Application=SC.Object.extend({rootElement:document,eventDispatcher:null,init:function(){var c,d=a(this,"rootElement");c=SC.EventDispatcher.create({rootElement:d}),b(this,"eventDispatcher",c),SC.$(document).ready(function(){c.setup()})},destroy:function(){a(this,"eventDispatcher").destroy()}})}(),function(){}(),function(){var a=SC.get,b=SC.set;SC.TEMPLATES={},SC.View=SC.Object.extend({concatenatedProperties:["classNames","classNameBindings"],isView:YES,templateName:null,templates:SC.TEMPLATES,template:function(b,c){if(c!==undefined)return c;var d=a(this,"templateName"),e=a(a(this,"templates"),d);if(!e&&d)throw new SC.Error('%@ - Unable to find template "%@".'.fmt(this,d));return e||a(this,"defaultTemplate")}.property("templateName").cacheable(),templateContext:function(a,b){return b!==undefined?b:this}.property().cacheable(),parentView:null,isVisible:!0,childViews:[],render:function(b){var c=a(this,"template");if(!!c){var d=a(this,"templateContext"),e={data:{view:this,isRenderData:!0}};this._didRenderChildViews=YES;var f=c(d,e);b.push(f)}},_applyClassNameBindings:function(){var b=a(this,"classNameBindings"),c=a(this,"classNames"),d,e,f;!b||b.forEach(function(a){var b,g=function(){e=this._classStringForProperty(a),d=this.$(),b&&d.removeClass(b),e?(d.addClass(e),b=e):b=null};SC.addObserver(this,a,g),f=this._classStringForProperty(a),f&&(c.push(f),b=f)},this)},_classStringForProperty:function(b){var c=b.split(":"),d=c[1];b=c[0];var e=SC.getPath(this,b);if(e===YES){if(d)return d;return SC.String.dasherize(a(b.split("."),"lastObject"))}return e!==NO&&e!==undefined&&e!==null?e:null},element:function(b,c){if(c!==undefined)return c;var d=a(this,"parentView");d&&(d=a(d,"element"));if(d)return this.findElementInParentElement(d)}.property("parentView").cacheable(),$:function(b){var c=a(this,"element");return c?b===undefined?SC.$(c):SC.$(b,c):SC.$()},mutateChildViews:function(b){var c=a(this,"childViews"),d=a(c,"length"),e;while(--d>=0)e=c[d],b.call(this,e);return this},forEachChildView:function(b){var c=a(this,"childViews"),d=a(c,"length"),e,f;for(f=0;f=c;i--)g[i].destroy()}},arrayDidChange:function(c,d,e,f){if(!!a(this,"element")){var g=a(this,"itemViewClass"),h=a(this,"childViews"),i=[],j,k,l,m,n,o,p,q,r,s;n=this.$();if(c){var t=c.slice(d,d+f);l=h.objectAt(d-1),o=l?l.$():null,s=a(t,"length");for(r=0;r{{title}}'),change:function(){SC.run.once(this,this._updateElementValue);return!1},_updateElementValue:function(){var b=this.$("input:checkbox");a(this,"value",b.prop("checked"))}})}(),function(){var a=SC.get,b=SC.set;SC.TextField=SC.View.extend({classNames:["sc-text-field"],insertNewline:SC.K,cancel:SC.K,type:"text",value:"",placeholder:null,defaultTemplate:function(){var b=a(this,"type");return SC.Handlebars.compile(''.fmt(b))}.property(),focusOut:function(a){this._elementValueDidChange();return!1},change:function(a){this._elementValueDidChange();return!1},keyUp:function(a){this.interpretKeyEvents(a);return!1},interpretKeyEvents:function(a){var b=SC.TextField.KEY_EVENTS,c=b[a.keyCode];if(c)return this[c](a);this._elementValueDidChange()},_elementValueDidChange:function(){var a=this.$("input");b(this,"value",a.val())},_valueDidChange:function(){SC.run.once(this,this._updateElementValue)},_updateElementValue:function(){var b=this.$("input");b.val(a(this,"value"))}}),SC.TextField.KEY_EVENTS={13:"insertNewline",27:"cancel"}}(),function(){}(),function(){var a=SC.get,b=SC.set,c=SC.getPath;SC._BindableSpanView=SC.View.extend({tagName:"span",shouldDisplayFunc:null,preserveContext:!1,displayTemplate:null,inverseTemplate:null,property:null,render:function(d){a(this,"isEscaped")&&b(d,"escapeContent",!0);var e=a(this,"shouldDisplayFunc"),f=a(this,"property"),g=a(this,"preserveContext"),h=a(this,"previousContext"),i=a(this,"inverseTemplate"),j=a(this,"displayTemplate"),k=c(h,f);if(e(k)){b(this,"template",j);if(g)b(this,"templateContext",h);else if(j)b(this,"templateContext",k);else{d.push(k);return}}else i?(b(this,"template",i),g?b(this,"templateContext",h):b(this,"templateContext",k)):b(this,"template",function(){return""});return this._super(d)},rerender:function(){var c;this.destroyAllChildren();var d=this.renderBuffer(a(this,"tagName"));a(this,"isEscaped")&&b(d,"escapeContent",!0),this.renderToBuffer(d),c=d.element(),this.$().replaceWith(c),b(this,"element",c),this._notifyDidCreateElement()}})}(),function(){var a=SC.get,b=SC.getPath;(function(){var c=function(c,d,e,f){var g=d.data,h=d.fn,i=d.inverse,j=g.view,k=this;if("object"==typeof this){var l=j.createChildView(SC._BindableSpanView,{preserveContext:e,shouldDisplayFunc:f,displayTemplate:h,inverseTemplate:i,property:c,previousContext:k,isEscaped:d.hash.escaped}),m,n;a(j,"childViews").pushObject(l),m=function(){a(l,"element")?l.rerender():SC.removeObserver(k,c,n)},n=function(){SC.run.once(m)},SC.addObserver(k,c,n);var o=l.renderBuffer(a(l,"tagName"));l.renderToBuffer(o);return new Handlebars.SafeString(o.string())}return b(this,c)};Handlebars.registerHelper("bind",function(a,b){return c.call(this,a,b,!1,function(a){return!SC.none(a)})}),Handlebars.registerHelper("boundIf",function(b,d){if(d)return c.call(this,b,d,!0,function(b){return SC.typeOf(b)==="array"?a(b,"length")!==0:!!b});throw new SC.Error("Cannot use boundIf helper without a block.")})})(),Handlebars.registerHelper("with",function(a,b){return Handlebars.helpers.bind.call(b.contexts[0],a,b)}),Handlebars.registerHelper("if",function(a,b){return Handlebars.helpers.boundIf.call(b.contexts[0],a,b)}),Handlebars.registerHelper("unless",function(a,b){var c=b.fn,d=b.inverse;b.fn=d,b.inverse=c;return Handlebars.helpers.boundIf.call(b.contexts[0],a,b)}),Handlebars.registerHelper("bindAttr",function(a){var c=a.hash,d=a.data.view,e=[],f=this,g=jQuery.uuid++,h=c["class"];if(h!==null&&h!==undefined){var i=SC.Handlebars.bindClasses(this,h,d,g);e.push('class="'+i.join(" ")+'"'),delete c["class"]}var j=SC.keys(c);j.forEach(function(a){var h=c[a],i=b(f,h),j,k;j=function j(){var c=b(f,h),e=d.$("[data-handlebars-id='"+g+"']");e.length===0?SC.removeObserver(f,h,k):c===NO?e.removeAttr(a):c===YES?e.attr(a,a):e.attr(a,c)},k=function(){SC.run.once(j)},SC.addObserver(f,h,k),i===YES&&(i=a),i!==NO&&e.push(a+'="'+i+'"')},this),e.push('data-handlebars-id="'+g+'"');return e.join(" ")}),SC.Handlebars.bindClasses=function(c,d,e,f){var g=[],h,i,j,k=function(d){var e=b(c,d);return e===YES?SC.String.dasherize(a(d.split("."),"lastObject")):e!==NO&&e!==undefined&&e!==null?e:null};d.split(" ").forEach(function(a){var b,d,l;d=function(){h=k(a),j=f?e.$("[data-handlebars-id='"+f+"']"):e.$(),j.length===0?SC.removeObserver(c,a,l):(b&&j.removeClass(b),h?(j.addClass(h),b=h):b=null)},l=function(){SC.run.once(d)},SC.addObserver(c,a,l),i=k(a),i&&(g.push(i),b=i)});return g}}(),function(){ 11 | var a=SC.get,b=SC.set;SC.Handlebars.ViewHelper=SC.Object.create({viewClassFromHTMLOptions:function(a,b){var c={},d=b["class"],e=!1;b.id&&(c.elementId=b.id,e=!0),d&&(d=d.split(" "),c.classNames=d,e=!0),b.classBinding&&(c.classNameBindings=b.classBinding.split(" "),e=!0),e&&(b=jQuery.extend({},b),delete b.id,delete b["class"],delete b.classBinding);return a.extend(b,c)},helper:function(c,d,e){var f=e.inverse,g=e.data,h=g.view,i=e.fn,j=e.hash,k;if("string"==typeof d){k=SC.getPath(c,d);if(!k)throw new SC.Error("Unable to find view at path '"+d+"'")}else sc_assert("You must pass a string or a view class to the #view helper",SC.View.detect(d)),k=d;sc_assert("Null or undefined object was passed to the #view helper. Did you mean to pass a property path string?",!!k),k=this.viewClassFromHTMLOptions(k,j);var l=g.view,m=a(l,"childViews"),n=l.createChildView(k);i&&b(n,"template",i),m.pushObject(n);var o=SC.RenderBuffer(a(n,"tagName"));n.renderToBuffer(o);return new Handlebars.SafeString(o.string())}}),Handlebars.registerHelper("view",function(a,b){a&&a.data&&a.data.isRenderData&&(b=a,a="SC.View");return SC.Handlebars.ViewHelper.helper(this,a,b)})}(),function(){var a=SC.get;SC.Handlebars.CONTAINER_MAP={ul:"li",ol:"li",table:"tr",thead:"tr",tbody:"tr",tfoot:"tr",tr:"td"},Handlebars.registerHelper("collection",function(b,c){b&&b.data&&b.data.isRenderData&&(c=b,b=undefined);var d=c.fn,e=c.data,f=c.inverse,g;g=b?SC.getPath(b):SC.CollectionView,sc_assert("%@ #collection: Could not find %@".fmt(e.view,b),!!g);var h=c.hash,i={},j;for(var k in h)h.hasOwnProperty(k)&&(j=k.match(/^item(.)(.*)$/),j&&(i[j[1].toLowerCase()+j[2]]=h[k],delete h[k]));var l=h.tagName||a(g,"proto").tagName,m=SC.Handlebars.CONTAINER_MAP[l];m&&(i.tagName=i.tagName||m),d&&(i.template=d,delete c.fn),f&&(h.emptyView=SC.View.extend({template:f})),h.preserveContext&&(i.templateContext=function(){return a(this,"content")}.property("content"),delete h.preserveContext);var n=a(g,"proto").itemViewClass;h.itemViewClass=SC.Handlebars.ViewHelper.viewClassFromHTMLOptions(n,i);return Handlebars.helpers.view.call(this,g,c)}),Handlebars.registerHelper("each",function(a,b){b.hash.contentBinding=SC.Binding.from("parentView."+a).oneWay(),b.hash.preserveContext=!0;return Handlebars.helpers.collection.call(this,null,b)})}(),function(){}(),function(){SC.$(document).ready(function(){SC.$('head script[type="text/html"]').each(function(){var a=SC.$(this),b=a.attr("data-template-name")||a.attr("id");if(!b)throw new SC.Error("Template found without a name specified.Please provide a data-template-name attribute.\n"+a.html());SC.TEMPLATES[b]=SC.Handlebars.compile(a.html()),a.remove()}),SC.$('body script[type="text/html"]').each(function(){var a=SC.$(this),b=SC.Handlebars.compile(a.html()),c=a.attr("data-view"),d=c?SC.getPath(c):SC.View;d=d.create({template:b}),d.createElement(),a.replaceWith(d.$())})})}(),function(){}(),function(){}() 12 | --------------------------------------------------------------------------------